We use the cleanup attribute heavily. It's useful for deferring
deallocation. For example, we have code like:
gs_unref_object NMBluezManager *self_keep_alive = g_object_ref(self);
where we don't use the variable otherwise, except for owning (and
freeing) the reference. This already lead to a compiler warning about
unused variable, which we would workaround with
_nm_unused gs_unref_object NMBluezManager *self_keep_alive = g_object_ref(self);
With clang 13.0.0~rc1-1.fc35, this got worse. Now for example also
static inline void
nm_strvarray_set_strv(GArray **array, const char *const *strv)
{
gs_unref_array GArray *array_old = NULL;
array_old = g_steal_pointer(array);
if (!strv || !strv[0])
return;
nm_strvarray_ensure(array);
for (; strv[0]; strv++)
nm_strvarray_add(*array, strv[0]);
}
leads to a warning
./src/libnm-glib-aux/nm-shared-utils.h:3078:28: error: variable array_old set but not used [-Werror,-Wunused-but-set-variable]
gs_unref_array GArray *array_old = NULL;
^
This is really annoying. We don't want to plaster our code with _nm_unused,
because that might hide actual issues. But we also want to keep using this
pattern and need to avoid the warning.
A problem is also that GCC usually does not warn about truly unused
variables with cleanup attribute. Clang was very useful here to flag
such variables. But now clang warns about cases which are no bugs, which
is a problem. So this does loose some useful warnings. On the other hand,
a truly unused variable (with cleanup attribute) is ugly, but not an actual
problem.
Now, with clang 13, automatically mark nm_auto() variables as _nm_unused
as workaround.
valgrind might log warnings about syscalls that it doesn't implement.
When we run valgrind tests, we check that the command exits with
success, but we also check that there is no unexpected content in the
valgrind log.
Those warnings are not relevant for us. We don't unit-tests valgrind, we
unit tests NetworkManager. Let's always remove such warnings with `sed`.
We already did that previously, but only for a explicit list of tests.
Now do it for all tests.
This is currently relevant on Fedora 35 and Ubuntu devel, where the
"close_range" syscall is used by libc, but not supported by valgrind.
While at it, rework the confusing logic of "HAS_ERRORS" variable.
There is g_idle_add(), g_timeout_add() and g_timeout_add_seconds().
We have alternatives nm_g_idle_add_source() and
nm_g_timeout_add_source().
I find the previous name nm_g_timeout_add_source_seconds() inconsistent
with the pattern, and get it always wrong on first try. Rename.
The nm_ip_address_dup() and nm_ip_route_dup() symbols were exposed in
libnm 1.32 and then backported to 1.30.8.
Export it also with version @libnm_1_30_8; this allows a program build
against libnm 1.30.8 to keep working with later versions of the library.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
It doesn't actually work inside the root-less container...
Well, it works as far as starting to activate, before it
fails. That is still somewhat useful. So have it there...
a0970f12f1f4 c-list: avoid comma-operator in conditionals
2ea502c5ee83 c-list: return self from c_list_init()
ca473417f7b3 build: use c99 instead of c11
99d8daf152fa ci: run on windows-2016
857a37cfc960 test/embed: split off GNU-extensions
c09e29697912 ci: run through MSVC
c3ba3dc82466 build: run test_embed only with gcc/clang
77c872dcc67d test/api: split of GNU tests
3ab849ea658e test/basic: test_extensions() -> test_gnu()
04fda9508c86 c-list: reorder iterators
58ab8fb29472 test: add c_list_entry_offset() to API tests
6d2fdc76de70 build: update AUTHORS
92b893fb3c4b c-list: remove trailing '\\' from macro definitions
c255c6a97a04 c-list: use size_t
b47da33dedf1 c-list: use uintptr_t for pointer arithmetic in c_list_entry()
9b798f50bbd0 c-list: require CList pointer for argument to c_list_entry() macro
42bbf43ab0af test: guard gcc'ism
942fcfd80862 c-list: make _c_list_entry_eval() part of the API
73a620259ca0 c-list: don't use elvis operator for c_list_entry() macro
da5e122bd698 test: drop unused argc/argv
f1eadf27377e test: verify c_list_entry() does not double-evaluate
git-subtree-dir: src/c-list
git-subtree-split: a0970f12f1f406a5578a5dedf3580cd682e55812
The subtree was moved from "shared/c-list" to "src/c-list". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/c-list
git commit -a -m 'dummy commit'
git subtree add --prefix src/c-list git@github.com:c-util/c-list.git 96455db9f04a6c9101a00957161551aea700b6aa --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/c-list git@github.com:c-util/c-list.git main --squash
The subtree was moved from "shared/c-rbtree" to "src/c-rbtree". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/c-rbtree
git commit -a -m 'dummy commit'
git subtree add --prefix src/c-rbtree git@github.com:c-util/c-rbtree.git 8aa7bd1828eedb19960f9eef98d15543ec9f34eb --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/c-rbtree git@github.com:c-util/c-rbtree.git main --squash
The subtree was moved from "shared/c-siphash" to "src/c-siphash". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/c-siphash
git commit -a -m 'dummy commit'
git subtree add --prefix src/c-siphash git@github.com:c-util/c-siphash.git eb87a9c4a5b0441ede073597253e1d0b7785e6be --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/c-siphash git@github.com:c-util/c-siphash.git main --squash
The subtree was moved from "shared/c-stdaux" to "src/c-stdaux". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/c-stdaux
git commit -a -m 'dummy commit'
git subtree add --prefix src/c-stdaux git@github.com:c-util/c-stdaux.git 346623b40eb8137cae7568a69ee42253ff098ff7 --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/c-stdaux git@github.com:c-util/c-stdaux.git main --squash
The subtree was moved from "shared/n-dhcp4" to "src/n-dhcp4". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/n-dhcp4
git commit -a -m 'dummy commit'
git subtree add --prefix src/n-dhcp4 git@github.com:nettools/n-dhcp4.git 281f431756e32b6a978a92e6c1a95478917a6720 --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/n-dhcp4 git@github.com:nettools/n-dhcp4.git master --squash
The subtree was moved from "shared/n-acd" to "src/n-acd". That confuses
git-subtree. To fix it, reimport the code with
rm -rf src/n-acd
git commit -a -m 'dummy commit'
git subtree add --prefix src/n-acd git@github.com:nettools/n-acd.git a600afc870872bbdfc8081ca68d5665334cb9e6e --squash
Then rebase the result to drop the bogus dummy commit from the history.
To update the library use:
git subtree pull --prefix src/n-acd git@github.com:nettools/n-acd.git master --squash
"nm_assert(_self->priv.p->combined_l3cd_commited)" might fail during deactivate.
At that point the combined/commited config is NULL, but we still have zombies.
We often want to be pedantic about not accepting %NULL for getters (or ref,
unref, etc). Often that is also inconvenient, so we would need to write:
if (l3cd)
strv = nm_l3_config_data_get_nameservers(l3cd, addr_family, &len);
else
len = 0;
(and, make sure that strv does not trigger a maybe-uninitialized warning).
Being pedanic here is more cumbersome than helpful. Accept NULL to return
the sensible default.
Also add nm_l3_config_data_get_dns_priority_or_default() helper which maps
NULL or a missing value to zero. This is also only for convenience for certain
callers.
The plain nm_strv_equal(), nm_strv_equal_n(), nm_strv_cmp_n() functions
treat NULL strv arrays (without specified length) different than strv
arrays of length zero. They do so, because that is useful sometimes.
Sometimes it is not useful and we want to treat empty arrays the same
as a NULL array. Add helpers for that.
N_ACD_E_DROPPED is an error code of n-acd, albeit internal. But such codes are returned
as postive values, unlike error codes from errno.h (which are negative).
Fix comparing for N_ACD_E_DROPPED, otherwise the error gets propagate to the caller
when we should handle it internally.
The idea was that NMIPConfig would register itself with the property (like "address-data")
and then NML3Cfg would emit the property changed notification.
However, we can already achive that via the regular notification, in particular
by listening to NM_L3_CONFIG_NOTIFY_TYPE_PLATFORM_CHANGE_ON_IDLE notification.
Also, NML3Cfg does not really understand the details when the property should
be emitted. For example, many routes not not exposed via "route-data" property,
and changes to those should not trigger a notification.
Drop the unused API.