diff options
| author | Michael Biebl <biebl@debian.org> | 2021-02-16 22:52:38 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2021-02-16 22:52:38 +0100 |
| commit | d32ef70c8f8831f40528e09b55e93f559a1cc3d9 (patch) | |
| tree | da29d8d7adc9e63eff2bbc422210e20a2835e098 /debian/patches/shared-refactor-nm_assert-for-NMRefString.patch | |
| parent | 6c616225b284e289570f0e30dd00d074399925e7 (diff) | |
Cherry-pick fixes from upstream nm-1-30 branch
- Fixes assertion when running the python-dbusmock test suite - Replaces our custom polkit-agent-helper-1 patch Closes: #982613
Diffstat (limited to 'debian/patches/shared-refactor-nm_assert-for-NMRefString.patch')
| -rw-r--r-- | debian/patches/shared-refactor-nm_assert-for-NMRefString.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/debian/patches/shared-refactor-nm_assert-for-NMRefString.patch b/debian/patches/shared-refactor-nm_assert-for-NMRefString.patch new file mode 100644 index 00000000..72d53614 --- /dev/null +++ b/debian/patches/shared-refactor-nm_assert-for-NMRefString.patch @@ -0,0 +1,54 @@ +From: Thomas Haller <thaller@redhat.com> +Date: Mon, 15 Feb 2021 10:04:52 +0100 +Subject: shared: refactor nm_assert() for NMRefString + +- also check consistency of the string. + +- disable more expensive check unless running with NM_MORE_ASSERTS>10. + +(cherry picked from commit ac1c66eb343693cb63b8624b4be6088e1583670e) +--- + shared/nm-glib-aux/nm-ref-string.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/shared/nm-glib-aux/nm-ref-string.c b/shared/nm-glib-aux/nm-ref-string.c +index 902f1c8..1084c47 100644 +--- a/shared/nm-glib-aux/nm-ref-string.c ++++ b/shared/nm-glib-aux/nm-ref-string.c +@@ -49,20 +49,28 @@ _ref_string_equal(gconstpointer pa, gconstpointer pb) + static void + _ASSERT(const RefString *rstr0) + { +-#if NM_MORE_ASSERTS + int r; + + nm_assert(rstr0); + +- G_LOCK(gl_lock); +- r = g_atomic_int_get(&rstr0->ref_count); ++ if (NM_MORE_ASSERTS > 0) { ++ r = g_atomic_int_get(&rstr0->ref_count); ++ nm_assert(r > 0); ++ nm_assert(r < G_MAXINT); ++ } + +- nm_assert(r > 0); +- nm_assert(r < G_MAXINT); ++ nm_assert(rstr0->r.str == rstr0->str_data); ++ nm_assert(rstr0->r.str[rstr0->r.len] == '\0'); + +- nm_assert(rstr0 == g_hash_table_lookup(gl_hash, rstr0)); +- G_UNLOCK(gl_lock); +-#endif ++ if (NM_MORE_ASSERTS > 10) { ++ G_LOCK(gl_lock); ++ r = g_atomic_int_get(&rstr0->ref_count); ++ nm_assert(r > 0); ++ nm_assert(r < G_MAXINT); ++ ++ nm_assert(rstr0 == g_hash_table_lookup(gl_hash, rstr0)); ++ G_UNLOCK(gl_lock); ++ } + } + + /** |