From f43846877bd903b7f4bad5d26dd138b53c75b345 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 18 Dec 2024 15:25:52 +0100 Subject: [PATCH 1/2] Avoid GNU `getcwd` extension behavior GNU `getcwd` can allocate a buffer if passed `NULL` for it. This is an extension which is e.g., not recognized by clang-tidy-19's `StdCLibraryFunctions` check[^1] which emits a diagnostic on a violated precondition `buf != NULL`, ``` The 1st argument to 'getcwd' is NULL but should not be NULL [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors] [build] 3987 | std::unique_ptr buffer{::getcwd(NULL, 0), std::free}; ``` This patch modifies this use of `getcwd` with this extension behavior to instead use `get_current_dir_name` which is also a GNU extension, but does not trigger this diagnostic. [^1]: https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions-c --- include/ghc/filesystem.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index 1770d73..89fccfd 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -4229,7 +4229,7 @@ GHC_INLINE path current_path(std::error_code& ec) } return path(std::wstring(buffer.get()), path::native_format); #elif defined(__GLIBC__) - std::unique_ptr buffer { ::getcwd(NULL, 0), std::free }; + std::unique_ptr buffer { ::get_current_dir_name(), std::free }; if (buffer == nullptr) { ec = detail::make_system_error(); return path(); From 99c3500205c7583623ca343a78b767f28b6dde53 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 18 Dec 2024 15:45:33 +0100 Subject: [PATCH 2/2] Replace EOL centos CI with rockylinux centos7 has reached EOL on 2024-06-30, centos8 on 2021-10-31. In practical terms this means that their package repositories are offline for the foreseeable future and the CI tasks making use of them might never run again. This patch replaces the existing CI jobs on centos7/centos8 with jobs on rockylinux8/9. Since rockylinux is an open source variant similar to RHEL this should provide testing with similar spirit. In contrast to centos, rockylinux does provide very granular tagging of releases which if used would help avoid breaking on e.g., subtle package changes in their package repositories. I however did not use very precise tags in the patch and instead went with broad "trains" for the 8 and 9 series; I hope this minimizes maintenance overhead (e.g., bumping to new releases) while still giving a good testing signal. --- .cirrus.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index fbd0e0b..b188205 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,25 +11,24 @@ freebsd_task: test_script: | sudo -u testuser .ci/unix-test.sh -centos7_task: +rockylinux8_task: container: - image: centos:7 + image: docker.io/rockylinux:8 install_script: | - yum install -y centos-release-scl - yum install -y devtoolset-9 - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - source /opt/rh/devtoolset-9/enable && PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh + .ci/unix-test.sh -centos8_task: +rockylinux9_task: container: - image: quay.io/centos/centos:stream8 + image: docker.io/rockylinux:9 install_script: | - yum group install -y "Development Tools" - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh \ No newline at end of file + .ci/unix-test.sh