From e27fed45fd1230aac81b5c91ee51c6a1c320fbb8 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 15 May 2022 16:03:01 -0400 Subject: [PATCH 1/4] sysroot: Quiet one gcc `-fanalyzer` warning I don't think this can happen in practice, but add an assertion to verify it. --- src/libostree/ostree-sysroot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 67afb5d2..12feb195 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1896,6 +1896,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, /* tracks when we come across the booted deployment */ gboolean before_booted = TRUE; gboolean before_merge = TRUE; + g_assert (deployments); for (guint i = 0; i < deployments->len; i++) { OstreeDeployment *deployment = deployments->pdata[i]; From 6a055f802ffb1a8a715bcd6be92623ebfa6eef30 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 16 May 2022 10:59:27 -0400 Subject: [PATCH 2/4] sysroot: Strengthen several `g_return_if_fail` into `g_assert()` Similar to prior changes; motivated by testing out an updated `gcc -fanalyzer`. --- src/libostree/ostree-sysroot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 12feb195..bcb55e55 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1267,7 +1267,7 @@ ostree_sysroot_get_booted_deployment (OstreeSysroot *self) OstreeDeployment * ostree_sysroot_require_booted_deployment (OstreeSysroot *self, GError **error) { - g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL); + g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED); if (!self->booted_deployment) return glnx_null_throw (error, "Not currently booted into an OSTree system"); @@ -1286,7 +1286,7 @@ ostree_sysroot_require_booted_deployment (OstreeSysroot *self, GError **error) OstreeDeployment * ostree_sysroot_get_staged_deployment (OstreeSysroot *self) { - g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL); + g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED); return self->staged_deployment; } @@ -1300,7 +1300,7 @@ ostree_sysroot_get_staged_deployment (OstreeSysroot *self) GPtrArray * ostree_sysroot_get_deployments (OstreeSysroot *self) { - g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL); + g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED); GPtrArray *copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); for (guint i = 0; i < self->deployments->len; i++) @@ -1525,7 +1525,7 @@ ostree_sysroot_query_deployments_for (OstreeSysroot *self, OstreeDeployment **out_pending, OstreeDeployment **out_rollback) { - g_return_if_fail (osname != NULL || self->booted_deployment != NULL); + g_assert (osname != NULL || self->booted_deployment != NULL); g_autoptr(OstreeDeployment) ret_pending = NULL; g_autoptr(OstreeDeployment) ret_rollback = NULL; From 41b9f8ff9716852ff78786c2e43037f77328bab9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 15 May 2022 16:03:38 -0400 Subject: [PATCH 3/4] ci: Drop gcc `-fanalyzer` by default There's a pile of new warnings in GCC 12 from F36, I dug into them but most of them seem inscrutable - I am not seeing the bugs. For now to unblock further work, stop using this flag. --- ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build.sh b/ci/build.sh index ffdeba01..2afcd018 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -30,6 +30,6 @@ esac # always fail on warnings; https://github.com/ostreedev/ostree/pull/971 # NB: this disables the default set of flags from configure.ac -export CFLAGS="-Wall -Werror -fanalyzer ${CFLAGS:-}" +export CFLAGS="-Wall -Werror ${CFLAGS:-}" build --enable-gtk-doc ${CONFIGOPTS:-} From 87cf46bbd92f9d4b7159b4baed247d3bef548384 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 16 May 2022 12:37:15 -0400 Subject: [PATCH 4/4] ci: Drop all `runAsUser: 0` in builds This triggers the new git warning; I think this is only here because long ago we used coreos-assembler as a buildroot, but that's long since fixed. --- .cci.jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 213d23c9..2a64109a 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -3,7 +3,7 @@ stage("Build") { parallel normal: { def n = 5 - buildPod(runAsUser:0, memory: "2Gi", cpu: "${n}") { + buildPod(memory: "2Gi", cpu: "${n}") { checkout scm stage("Core build") { shwrap(""" @@ -39,7 +39,7 @@ parallel normal: { }, // A minimal build, helps test our build options minimal: { - buildPod(runAsUser:0) { + buildPod() { checkout scm shwrap(""" git submodule update --init @@ -54,7 +54,7 @@ minimal: { } }, codestyle: { - buildPod(runAsUser:0) { + buildPod() { checkout scm shwrap(""" # Jenkins by default only fetches the branch it's testing. Explicitly fetch main