From patchwork Thu Jun 6 09:31:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13688192 Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 126CF178395 for ; Thu, 6 Jun 2024 09:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666313; cv=none; b=joMkA+/2JVR/H1Q7YdcPefQQjgRIC17s4A5sqFswJ3EUft5AxvvWqXmQSxFUtlXGKCTfYTLPjcTNgiy4FxWcFC5dYE3CdBS0fBK2rJCAwkM8/siJi9F8/XsJaWQ7klvmL0Xs3OZXeTYJtJ/V5SuKvAemcX62mdFMU8KIRoH1Ozk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666313; c=relaxed/simple; bh=s3O5p1J+UeQ2khwD8/2s030Pm2VUsZVJewLFqLgUeV0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q9ayaDWKJLDUTFGWVfpeR+4XhIAK4FFs8XLh1AKtAHlwVtTKM5cv5/K564QvYL+rQZKG5midZOoikm6xmlMDWhyCp1I9kz8oKScxcfW7yPPtv+qKI5zGv1X8uQlB5oCmNvoaOWwPDPPp77NFfMgueVA+4jI1pJ3yJVtZ0mDGvc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Ra9qrPoo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TNZdbCs7; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Ra9qrPoo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TNZdbCs7" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 0B9C5138011C; Thu, 6 Jun 2024 05:31:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 06 Jun 2024 05:31:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1717666311; x=1717752711; bh=WFEJpE1oKw dgbR8KuQo+mk+YjsJ0gJJallABHnqOPf0=; b=Ra9qrPooez3oEqDrm6N6QVlLJJ BkP0Fw+OtBSpBNbhxWh2ckN1nDkR6mZEArYXjthx2SOgWEWpt4JZJcdVohystroM dLRMm5BRvNUkc80yRqeM2enQkXDL2LHfh9gPzGgVcT3AOaXddhlZfi4hwH38clJw vHREbYT2UWi6r9mGflTf2tMAO1d8Be+gQ3YT3P0FjQ+UVWNUNFv/5/jlJl8JMeVg agpXXexpmelW60gWnTKAW+qQWgU12ykcmp3hJfh6z66lqdse7mIqjIYeGnlWa/4j +369W6km/u3KMJBtxR+imHna1C9pFvI927/EPryyQkVpjAtmryULjoG3+O6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717666311; x=1717752711; bh=WFEJpE1oKwdgbR8KuQo+mk+YjsJ0 gJJallABHnqOPf0=; b=TNZdbCs73q/KJp45BEOjM+chNWuXMxiBemf3bxNJLkGx bLd87GaaP7PgBw/8nzsxY+TVO3+1Wgjop8jroh0vRpASYvslF3lCEA2Xk5DbLYJQ w7yRPnexT2uJ5LXKSInldfUs/GyyDKyZY2zJ9MBlT33AKEn4urIoY6m9efJWw2cL ARYATgnjBaYdolaTPKx2DtYot43DadN1NCwCcTiswlGNg2obTnFsi9QgnvkLbgXy AlevIKE6g8ONJMkbyTOGWqJsT54DRM7NKpHjn5oMN/3ZFGuHgZNlO6WehmtdJ6CR W8w9T1IOnHxxOjaLLjwGEvlpxvJvWXy4+UQEw8/Kuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelkedgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehgtd erredttddvnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucggtffrrghtthgvrhhnpeeukedtvedtffevleejtefgheehieegke eluddvfeefgeehgfeltddtheejleffteenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jun 2024 05:31:49 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id fbc1c5cb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 6 Jun 2024 09:31:12 +0000 (UTC) Date: Thu, 6 Jun 2024 11:31:40 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH v2 1/2] ci: fix check for Ubuntu 20.04 Message-ID: References: <20240606080552.GA658959@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: In 5ca0c455f1 (ci: fix Python dependency on Ubuntu 24.04, 2024-05-06), we made the use of Python 2 conditional on whether or not the CI job runs Ubuntu 20.04. There was a brown-paper-bag-style bug though, where the condition forgot to invoke the `test` builtin. The result of it is that the check always fails, and thus all of our jobs run with Python 3 by accident. Fix this. Signed-off-by: Patrick Steinhardt --- ci/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/lib.sh b/ci/lib.sh index 1f4059b1b8..814578ffc6 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -328,7 +328,7 @@ ubuntu-*) # Python 2 is end of life, and Ubuntu 23.04 and newer don't actually # have it anymore. We thus only test with Python 2 on older LTS # releases. - if "$distro" = "ubuntu-20.04" + if test "$distro" = "ubuntu-20.04" then PYTHON_PACKAGE=python2 else From patchwork Thu Jun 6 09:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13688193 Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE77153BC2 for ; Thu, 6 Jun 2024 09:31:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666314; cv=none; b=RNl2ZMqDAMh1NgW5l1A6FWgpQJQIMrzKccvkdbdjDgMXXJm/pt6R+6mMGTzapXWB/vs7matdFGmgyzSAnPTHsiDTxk1wR+5WX6ZdzePJ+5KuHMBZzhfqw6y3L5z7+2k0mUBqTphsfATN2DBgCwKfNaH/hQOGnoTB6wP9D17DB0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666314; c=relaxed/simple; bh=yuwBIyCrNeAhYtQc/pth5ZynEH4S7DOcRDT7pCdJ2Q4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PqcQ5T5Pv4mVPQz6C3UuV3bGt0zfq+exkgHoBY6hpW599Jhv2HKATn2O8GxvsutXdWhyq9xmgpFVCFkIHS7Sn690fagxYQAXu/1uyYjFSyG67IwBfkY6Jd+HmLKHwN2uoBgQkkv4t5Is+q3v+joHBMiBkTtBVF1+IXcU6j5r08g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=d5R/iNU4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fNOn2/ah; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="d5R/iNU4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fNOn2/ah" Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id 27099138010E; Thu, 6 Jun 2024 05:31:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 06 Jun 2024 05:31:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1717666312; x=1717752712; bh=FL+jlV9UQ4 ryboSf3SFsKrfdd4joKMyrlyfQ267iwqg=; b=d5R/iNU4By9Bbno9QZv+xqcShv 8PZ00q+FeD9VYRbiO0/cqLdPpT7bxzJjiMsyjg75keP8JMTjvD5AM7SrxLmXf1dH 09otcLfMGijK4rsxCj/PTEwpTo9DyTJ6+3KYlrQoyrenoXQgBEjk1dIhLFmMtGu6 0Shn5WPjc8KGs/A2whbKS0iAlMQMQheT82eg+7A04E5tCHoZyKN55g0nhmbP7YY4 XaODTAl8AGzN+lCoYHHR9IxXF2BFlpKek+GHE3itZQVQzL4eb/WOXvZXNGPPmyLi ON0v7Iz6jYg2P33OfMWCZZzyiIdF5OEb02fYPZOKRMv5PG3+NlHI7JD9dN+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717666312; x=1717752712; bh=FL+jlV9UQ4ryboSf3SFsKrfdd4jo KMyrlyfQ267iwqg=; b=fNOn2/ah3kwJJIXg/cuc1LUdypA7LLvfWOSahiYuWq8Q yl+a7sGn8mh+dTYs7cXl7m3OFGTODojXTqNsjcEDfGrywFfjIlbqBR+pd9OAMfkh XvYGEyiGE6Dm0rKENWFkits3IfFTShEwK9PIWdoxhYValRAOBvpe7Oqy+ycSpvh/ m1xqJSceQdy/QVV8AfT63ULcA7zovPfbUcrr4ktDu6shETT7cM8nIi+wQvYlBUZH T2Vl2MA5OE5Qmfqt0qT7qPeCYG9oE2oTYdDLktUI936b/5xRhBhcF0JmUJh8fcCW bbbIECZkf0DEcze40+fu7H8a8RbQ4xORlcc7R5ZSaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelkedgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehgtd erredttddvnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshes phhkshdrihhmqeenucggtffrrghtthgvrhhnpeeukedtvedtffevleejtefgheehieegke eluddvfeefgeehgfeltddtheejleffteenucevlhhushhtvghrufhiiigvpedunecurfgr rhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jun 2024 05:31:51 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id df4cb0f7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 6 Jun 2024 09:31:17 +0000 (UTC) Date: Thu, 6 Jun 2024 11:31:45 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano Subject: [PATCH v2 2/2] ci: compile "linux-gcc-default" job with -Og Message-ID: References: <20240606080552.GA658959@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: We have recently noticed that our CI does not always notice variables that may be used uninitialized. While it is expected that compiler warnings aren't perfect, this one was a but puzzling because it was rather obvious that the variable can be uninitialized. Many compiler warnings unfortunately depend on the optimization level used by the compiler. While `-O0` for example will disable a lot of warnings altogether because optimization passes go away, `-O2`, which is our default optimization level used in CI, may optimize specific code away or even double down on undefined behaviour. Interestingly, this specific instance that triggered the investigation does get noted by GCC when using `-Og`. While we could adapt all jobs to compile with `-Og` now, that would potentially mask other warnings that only get diagnosed with `-O2`. Instead, adapt the "linux-gcc-default" job to compile with `-Og`. This job is chosen because it uses the "ubuntu:latest" image and should thus have a comparatively recent compiler toolchain, and because we have other jobs that use "ubuntu:latest" so that we do not loose coverage for warnings diagnosed only on `-O2` level. To make it easier to set up the optimization level in our CI, add support in our Makefile to specify the level via an environment variable. Signed-off-by: Patrick Steinhardt --- I was a little torn whether we really want to name the variable `O` here because it feels so easy to set it by accident. We could rename this to `OPTIMIZATION` or `OPTIMIZATION_LEVEL`, but that's quite a mouthful. Alternatively, if we don't want to have this variable in the first place, then I'm also happy to adapt the script itself to pass the optimization level via an argument. Makefile | 3 ++- ci/run-build-and-tests.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59d98ba688..ff57c94fdf 100644 --- a/Makefile +++ b/Makefile @@ -1357,7 +1357,8 @@ endif # tweaked by config.* below as well as the command-line, both of # which'll override these defaults. # Older versions of GCC may require adding "-std=gnu99" at the end. -CFLAGS = -g -O2 -Wall +O ?= 2 +CFLAGS = -g -O$(O) -Wall LDFLAGS = CC_LD_DYNPATH = -Wl,-rpath, BASIC_CFLAGS = -I. diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh index 98dda42045..0f00dbd289 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -13,6 +13,15 @@ esac run_tests=t case "$jobname" in +linux-gcc-default) + # Warnings generated by compilers are unfortunately specific to the + # optimization level. With `-O0`, many warnings won't be shown at all, + # whereas the optimizations performed by our default optimization level + # `-O2` will mask others. We thus use `-Og` here just so that we have + # at least one job with a different optimization level so that we can + # overall surface more warnings. + export O=g + ;; linux-gcc) export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main ;;