From 3d42b2f1fa567ae6704bd3978e0649c0a70d1a60 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 15:16:39 +0200 Subject: [PATCH 1/7] shared: fix _NM_ENSURE_TYPE_CONST() for const pointers with clang Clang 3.4.2-9.el7 on CentOS7.6 complains about missing generic type match: ../dispatcher/nm-dispatcher.c:243:2: error: controlling expression type 'const Request *const' (aka 'const struct Request *const') not compatible with any generic association type _LOG_R_D (request, "start running ordered scripts..."); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 17dc6a9da68a ('shared: add _NM_ENSURE_TYPE_CONST()') --- shared/nm-glib-aux/nm-macros-internal.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 1ff90dc5d4..fa2792ec88 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -635,7 +635,11 @@ NM_G_ERROR_MSG (GError *error) * It's useful to check the let the compiler ensure that @value is * of a certain type. */ #define _NM_ENSURE_TYPE(type, value) (_Generic ((value), type: (value))) -#define _NM_ENSURE_TYPE_CONST(type, value) (_Generic ((value), const type: ((const type) (value)), type: ((const type) (value)))) +#define _NM_ENSURE_TYPE_CONST(type, value) (_Generic ((value), \ + const type : ((const type) (value)), \ + const type const: ((const type) (value)), \ + type : ((const type) (value)), \ + type const: ((const type) (value)))) #else #define _NM_ENSURE_TYPE(type, value) (value) #define _NM_ENSURE_TYPE_CONST(type, value) ((const type) (value)) From ad06cc78dc086115729331f202fa86afd045ae6e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 14:56:50 +0200 Subject: [PATCH 2/7] platform: make nm_platform_kernel_support_get() macro an inline function clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals(). I am not even quoting the error message, it's totally non-understandable. nm_hash_update_vals() uses typeof(), and in some obscure cases, clang dislikes when the argument itself is some complex macro. I didn't fully understand why, but this works around it. I would prefer to fix nm_hash_update_vals() to not have this limitation. But I don't know how. There is probably no downside to have this an inline function instead of a macro. --- src/platform/nm-platform.h | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index a6b5f2c4c3..8c0a8764e2 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -919,28 +919,28 @@ extern volatile int _nm_platform_kernel_support_state[_NM_PLATFORM_KERNEL_SUPPOR int _nm_platform_kernel_support_init (NMPlatformKernelSupportType type, int value); -#define _nm_platform_kernel_support_detected(type) \ - G_LIKELY (({ \ - const NMPlatformKernelSupportType _type = (type); \ - \ - nm_assert (_NM_INT_NOT_NEGATIVE (_type) && _type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); \ - \ - (_nm_platform_kernel_support_state[_type] != 0); \ - })) +static inline gboolean +_nm_platform_kernel_support_detected (NMPlatformKernelSupportType type) +{ + nm_assert ( _NM_INT_NOT_NEGATIVE (type) + && type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); -#define nm_platform_kernel_support_get(type) \ - ({ \ - const NMPlatformKernelSupportType _type = (type); \ - int _v; \ - \ - nm_assert (_NM_INT_NOT_NEGATIVE (_type) && _type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); \ - \ - _v = _nm_platform_kernel_support_state[_type]; \ - if (G_UNLIKELY (_v == 0)) \ - _v = _nm_platform_kernel_support_init (_type, 0); \ - \ - (_v >= 0); \ - }) + return G_LIKELY (_nm_platform_kernel_support_state[type] != 0); +} + +static inline gboolean +nm_platform_kernel_support_get (NMPlatformKernelSupportType type) +{ + int v; + + nm_assert (_NM_INT_NOT_NEGATIVE (type) + && type < G_N_ELEMENTS (_nm_platform_kernel_support_state)); + + v = _nm_platform_kernel_support_state[type]; + if (G_UNLIKELY (v == 0)) + v = _nm_platform_kernel_support_init (type, 0); + return (v >= 0); +} /*****************************************************************************/ From 5113c5bd00f061a407e2dc941cc462bc36fc2948 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 15:07:34 +0200 Subject: [PATCH 3/7] platform: avoid compiler error passing NMP_OBJECT_CAST_OBJ_WITH_IFINDEX() to nm_hash_update_vals() Clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals(). Clang seems to dislike passing certain complex arguments to typeof(). I'd prefer to fix nm_hash_update_vals() to not have this problem, but I don't know how. This works around the issue. --- src/platform/nmp-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index 0d20100cae..792c4e7b84 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -398,7 +398,7 @@ _idx_obj_part (const DedupMultiIdxType *idx_type, if (h) { nm_hash_update_vals (h, idx_type->cache_id_type, - NMP_OBJECT_CAST_OBJ_WITH_IFINDEX (obj_a)->ifindex); + obj_a->obj_with_ifindex.ifindex); } return 1; From 7af1fc803e98a8201a9c79cf11494de13151527f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 25 May 2019 11:03:11 +0200 Subject: [PATCH 4/7] clients/tests: increase timeout waiting for stub D-Bus service I saw this timeout reached in our gitlab-ci. I think it was due to the machine being busy and taking more than 2 seconds. Assuming the timeout was just too short, increase it to 4 seconds. --- clients/tests/test-client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index b2411d6e52..ff5a3604dd 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -324,7 +324,7 @@ class NMStubServer: nmobj = self._conn_get_main_object(self._conn) if nmobj is not None: break - if (NM.utils_get_timestamp_msec() - start) >= 2000: + if (NM.utils_get_timestamp_msec() - start) >= 4000: p.stdin.close() p.kill() Util.popen_wait(p, 1000) From a307bd6ec4c1724324d0a2fbb09ebfe46a996d13 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 28 May 2019 13:08:32 +0200 Subject: [PATCH 5/7] build: disable "-Wunknown-pragmas" warning clang on CentOS 7.6 (3.4.2-9.el7) warns: CC clients/tui/newt/clients_tui_newt_libnmt_newt_a-nmt-newt-button.o In file included from ../clients/tui/newt/nmt-newt-button.c:26: In file included from ../shared/nm-default.h:280: ../shared/nm-glib-aux/nm-macros-internal.h:1617:2: error: unknown warning group -Wstringop-truncation, ignored [-Werror,-Wunknown-pragmas] NM_PRAGMA_WARNING_DISABLE ("-Wstringop-truncation"); ^ ../shared/nm-glib-aux/nm-macros-internal.h:419:9: note: expanded from macro NM_PRAGMA_WARNING_DISABLE _Pragma(_NM_PRAGMA_WARNING_DO(warning)) ^ :109:25: note: expanded from here GCC diagnostic ignored "-Wstringop-truncation" ^ This warning totally defeats the purpose of why we use the pragma in the first place. --- m4/compiler_options.m4 | 1 + meson.build | 1 + 2 files changed, 2 insertions(+) diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index 9f167a103b..5235e037df 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -89,6 +89,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wno-missing-field-initializers \ -Wno-pragmas \ -Wno-sign-compare \ + -Wno-unknown-pragmas \ -Wno-unused-parameter \ ; do dnl GCC 4.4 does not warn when checking for -Wno-* flags (https://gcc.gnu.org/wiki/FAQ#wnowarning) diff --git a/meson.build b/meson.build index e6b220c62b..af4faa4bc6 100644 --- a/meson.build +++ b/meson.build @@ -152,6 +152,7 @@ if nm_debug '-Wno-missing-field-initializers', '-Wno-pragmas', '-Wno-sign-compare', + '-Wno-unknown-pragmas', '-Wno-unused-parameter', '-Wparentheses-equality', '-Wpointer-arith', From c9873d42731b7586926ad3a99f93f08490f25abd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 May 2019 12:29:49 +0200 Subject: [PATCH 6/7] gitlab-ci: run "checkpatch" test on Fedora 29 image Fedora 28 is no longer supported at this point. Run the "checkpatch" test on a Fedora 29 image instead. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c6b131aaa..13db037e17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,7 +54,7 @@ stages: - date '+%Y%m%d-%H%M%S'; test "$NM_BUILD_TARBALL" != 1 || mv /tmp/NetworkManager-1*.tar.xz /tmp/NetworkManager-1*.src.rpm ./ checkpatch: - image: fedora:28 + image: fedora:29 stage: test script: - date '+%Y%m%d-%H%M%S'; dnf install -y git From 896dc7d4d93d1b9a67b1b531168faf358541e75e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 May 2019 12:48:20 +0200 Subject: [PATCH 7/7] gitlab-ci: also build on CentOS 7.5 and 7.6 --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++------- contrib/fedora/REQUIRED_PACKAGES | 2 ++ contrib/scripts/nm-ci-run.sh | 2 +- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13db037e17..f8258e457a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,18 +10,29 @@ stages: .fedora_install: &fedora_install before_script: - - date '+%Y%m%d-%H%M%S'; NM_INSTALL="dnf install -y" ./contrib/fedora/REQUIRED_PACKAGES - - date '+%Y%m%d-%H%M%S'; dnf install -y glibc-langpack-pl ccache clang + + # enable EPEL on CentOS + - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + + - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || (yum install -y glibc-common && localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8 && locale -a) + + - date '+%Y%m%d-%H%M%S'; NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES + - date '+%Y%m%d-%H%M%S'; yum install -y glibc-langpack-pl ccache clang which # containers have "tsflags=nodocs" in /etc/dnf/dnf.conf. We need /usr/shared/gtk-doc/html # to generate proper documentation. - - date '+%Y%m%d-%H%M%S'; dnf reinstall -y --setopt='tsflags=' glib2-doc + - date '+%Y%m%d-%H%M%S'; yum reinstall -y --setopt='tsflags=' glib2-doc - - date '+%Y%m%d-%H%M%S'; dnf install -y python3-dnf-plugins-core - - date '+%Y%m%d-%H%M%S'; dnf debuginfo-install -y glib2 + - date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y python36-dbus python36-gobject-base + + - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf install -y python3-dnf-plugins-core + - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf debuginfo-install -y glib2 + - date '+%Y%m%d-%H%M%S'; which dnf || debuginfo-install -y glib2 - date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-patch-gtkdoc.sh || true + - date '+%Y%m%d-%H%M%S'; test -x /usr/bin/ninja || ! test -x /usr/bin/ninja-build || ln -s /usr/bin/ninja-build /usr/bin/ninja + .debian_install: &debian_install before_script: - date '+%Y%m%d-%H%M%S'; apt-get update @@ -39,15 +50,15 @@ stages: - date '+%Y%m%d-%H%M%S'; locale -a - date '+%Y%m%d-%H%M%S'; env - date '+%Y%m%d-%H%M%S'; meson --version - - date '+%Y%m%d-%H%M%S'; ! which dnf || dnf list --installed - date '+%Y%m%d-%H%M%S'; ! which dpkg || dpkg -l + - date '+%Y%m%d-%H%M%S'; ! which yum || yum list installed - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; rm -rf /tmp/nm-docs-html; mv build/INST/share/gtk-doc/html /tmp/nm-docs-html - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh - date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh - - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=Fedora' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test - - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=Fedora' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson + - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=.*\(Fedora\|CentOS\)' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -W meson + - date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=.*\(Fedora\)' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson - date '+%Y%m%d-%H%M%S'; git clean -fdx ; test "$NM_BUILD_TARBALL" != 1 || ( ./contrib/fedora/rpm/build_clean.sh -r && mv ./NetworkManager-1*.tar.xz /tmp/ && mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm /tmp/ ) - date '+%Y%m%d-%H%M%S'; git clean -fdx - date '+%Y%m%d-%H%M%S'; mv /tmp/nm-docs-html ./docs-html @@ -95,6 +106,17 @@ t_fedora:rawhide: allow_failure: true when: manual +t_centos:7.5.1804: + <<: *fedora_install + image: centos:7.5.1804 + <<: *do_build + when: manual + +t_centos:7.6.1810: + <<: *fedora_install + image: centos:7.6.1810 + <<: *do_build + t_ubuntu:16.04: <<: *debian_install image: ubuntu:16.04 diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 9928cf0000..00164cc669 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -52,8 +52,10 @@ install \ newt-devel \ nss-devel \ polkit-devel \ + ppp \ ppp-devel \ pygobject3-base \ + python-gobject-base \ python3-dbus \ python3-gobject \ qt-devel \ diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index 1d4b573439..dd8fd28457 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -126,7 +126,7 @@ _print_test_logs() { echo ">>>> PRINT TEST LOGS $1 (done)" if _with_valgrind; then echo ">>>> PRINT VALGRIND LOGS $1 (start)" - find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ + find -name '*.valgrind-log' -print0 | xargs -0 grep -H ^ || true echo ">>>> PRINT VALGRIND LOGS $1 (done)" fi }