From da87b58014c1673ed8c47a14d315ad5ad4d801db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 17 Jul 2024 06:17:41 +0700 Subject: [PATCH 1/3] sparse: ignore warning from new glibc headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With at least glibc 2.39, glibc provides a function declaration that matches with this POSIX interface: int regexec(const regex_t *restrict preg, const char *restrict string, size_t nmatch, regmatch_t pmatch[restrict], int eflags); such prototype requires variable-length-array for `pmatch'. Thus, sparse reports this error: > ../add-patch.c: note: in included file (through ../git-compat-util.h): > /usr/include/regex.h:682:41: error: undefined identifier '__nmatch' > /usr/include/regex.h:682:41: error: bad constant expression type > /usr/include/regex.h:682:41: error: Variable length array is used. Note: `__nmatch' is POSIX's nmatch. The glibc's intention is informing their users to provides a large enough buffer to hold `__nmatch' results and provides diagnosis if necessary. It's merely a glibc' implementation detail. Hide that usage from sparse by using standard C11's macro: __STDC_NO_VLA__ Signed-off-by: Đoàn Trần Công Danh Signed-off-by: Junio C Hamano --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7315507381e146..3868edd349eac2 100644 --- a/Makefile +++ b/Makefile @@ -1409,7 +1409,7 @@ ARFLAGS = rcs PTHREAD_CFLAGS = # For the 'sparse' target -SPARSE_FLAGS ?= -std=gnu99 +SPARSE_FLAGS ?= -std=gnu99 -D__STDC_NO_VLA__ SP_EXTRA_FLAGS = # For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets From 832d9f6d0b57c353d18cf145835659ab5ac0124c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 8 Apr 2025 22:56:33 +0200 Subject: [PATCH 2/3] ci: upgrade `sparse` to supported build agents The `sparse` job still uses the `ubuntu-20.04` runner pool, but that pool is about to go away, so let's stop using it. There is no `sparse-22.04` artifact provided by the "Build sparse for Ubuntu" Azure Pipeline, but that is not necessary anyway because Ubuntu 22.04 has the `sparse` package: https://packages.ubuntu.com/jammy/sparse Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- .github/workflows/main.yml | 11 +---------- ci/install-dependencies.sh | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9959b61ece2bcc..1c8260ecb68b76 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -446,20 +446,11 @@ jobs: if: needs.ci-config.outputs.enabled == 'yes' env: jobname: sparse - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 concurrency: group: sparse-${{ github.ref }} cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} steps: - - name: Download a current `sparse` package - # Ubuntu's `sparse` version is too old for us - uses: git-for-windows/get-azure-pipelines-artifact@v0 - with: - repository: git/git - definitionId: 10 - artifact: sparse-20.04 - - name: Install the current `sparse` package - run: sudo dpkg -i sparse-20.04/sparse_*.deb - uses: actions/checkout@v4 - name: Install other dependencies run: ci/install-dependencies.sh diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index 0df74610d063fb..8700c0f2924d7f 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -119,7 +119,7 @@ StaticAnalysis) sparse) sudo apt-get -q update -q sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \ - libexpat-dev gettext zlib1g-dev + libexpat-dev gettext zlib1g-dev sparse ;; Documentation) sudo apt-get -q update From 419e29e832295ad1ad2b7ab5d97a5d5102a0724d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 16 Apr 2025 07:17:24 +0200 Subject: [PATCH 3/3] ci(pedantic): ensure that awk is installed The image pointed to by the fedora:latest tag has moved from fedora 41 to 42. The fedora 41 container images have awk installed while the fedora 42 images do not. That change is most likely just part of reducing the size of the base container images. In both AlmaLinux and Fedora (as well as other RHEL derivatives/relatives), awk is provided by the gawk package. On Fedora, `dnf install awk` would work, but for unintended reasons! It uses the package filelist data to determine that /usr/bin/awk is provided by gawk and installs gawk as a result. On AlmaLinux (8 & 9, by my quick testing), that is not the case and you'd need to use `dnf install gawk` or `dnf install '*bin/awk'` to get it installed. Having said that, awk _is_ included in the current AlmaLinux 8 and 9 images, so it isn't strictly needed. But it's probably better to be explicit that we need it installed, as a defense against some future change to the AlmaLinux container removing awk. Using the package name "gawk" is the right thing to do. Note that even '*bin/awk' would have worked, but it is less specific. And who knows, maybe in the far future a BSD variant of awk is offered, too, and would then cause ambiguities. Best to avoid that. Suggested-by: Todd Zullinger Signed-off-by: Johannes Schindelin --- ci/install-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index 8700c0f2924d7f..be9ba5e30a477b 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -31,7 +31,7 @@ alpine-*) ;; fedora-*|almalinux-*) dnf -yq update >/dev/null && - dnf -yq install shadow-utils sudo make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null + dnf -yq install shadow-utils sudo make gcc findutils diffutils perl python3 gawk gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null ;; ubuntu-*|i386/ubuntu-*|debian-*) # Required so that apt doesn't wait for user input on certain packages.