From 0c9625fc1b0df72a28709e3a630a16d697e483e9 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 22 Jul 2026 10:18:12 +0000 Subject: [PATCH 1/3] fix(ci): keep coverage profraw writable under umask 0777 tests Some uutests set umask(0777) before spawning the utility. LLVM profile files created under that umask can be mode 000; later writes fail with Permission denied on stderr and break exact asserts (e.g. mkfifo). Prepare the profraw directory with a default owner-write ACL when setfacl is available (hard-fail under CI), use coverage-%p-%m.profraw, and install acl on the coverage Ubuntu job. Signed-off-by: Alex Chen --- .github/workflows/CICD.yml | 3 ++- util/build-run-test-coverage-linux.sh | 38 ++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 15c9b530269..bcf3cd796f7 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -772,8 +772,9 @@ jobs: case '${{ matrix.job.os }}' in ubuntu-latest) # selinux and systemd headers needed to build tests + # acl: setfacl for coverage profraw dir default ACL (umask 0777 tests) sudo apt-get -y update - sudo apt-get -y install libselinux1-dev libsystemd-dev + sudo apt-get -y install libselinux1-dev libsystemd-dev acl # pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd. # In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands, and "system boot" entry is missing. # The account also has empty gecos fields. diff --git a/util/build-run-test-coverage-linux.sh b/util/build-run-test-coverage-linux.sh index 83faf107280..5ac8e12762e 100755 --- a/util/build-run-test-coverage-linux.sh +++ b/util/build-run-test-coverage-linux.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # spell-checker:ignore (env/flags) Ccodegen Cinstrument Coverflow Cpanic Zpanic -# spell-checker:ignore PROFDATA PROFRAW coreutil librairies nextest profdata profraw rustlib +# spell-checker:ignore PROFDATA PROFRAW coreutil librairies nextest profdata profraw rustlib setfacl # This script will build, run and generate coverage reports for the whole # testsuite. @@ -53,7 +53,37 @@ PROFDATA_DIR="${COVERAGE_DIR}/data" REPORT_DIR="${COVERAGE_DIR}/report" REPORT_PATH="${REPORT_DIR}/total.lcov.info" -rm -rf "${PROFRAW_DIR}" && mkdir -p "${PROFRAW_DIR}" +# Some tests set umask(0777) via uutests pre_exec. LLVM profile files created +# under that umask can be mode 000; later writes fail with EACCES and the error +# lands on utility stderr (breaks exact asserts, e.g. mkfifo). +# Default ACL keeps new .profraw files owner-writable. %p-%m avoids a shared +# %4m profile pool across processes. +prepare_profraw_dir() { + rm -rf "${PROFRAW_DIR}" + mkdir -p "${PROFRAW_DIR}" + chmod 700 "${PROFRAW_DIR}" + if ! command -v setfacl >/dev/null 2>&1; then + if [ -n "${CI:-}" ]; then + echo "error: setfacl required for coverage profraw dir (install acl)" >&2 + exit 1 + fi + return 0 + fi + if ! setfacl -d -m u::rw,g::---,o::---,m::rw "${PROFRAW_DIR}"; then + if [ -n "${CI:-}" ]; then + echo "error: setfacl default ACL failed on ${PROFRAW_DIR}" >&2 + exit 1 + fi + fi + if ! setfacl -m u::rwx,g::---,o::---,m::rwx "${PROFRAW_DIR}"; then + if [ -n "${CI:-}" ]; then + echo "error: setfacl access ACL failed on ${PROFRAW_DIR}" >&2 + exit 1 + fi + fi +} + +prepare_profraw_dir rm -rf "${PROFDATA_DIR}" && mkdir -p "${PROFDATA_DIR}" rm -rf "${REPORT_DIR}" && mkdir -p "${REPORT_DIR}" @@ -64,7 +94,7 @@ export RUSTC_BOOTSTRAP=1 export CARGO_INCREMENTAL=0 export RUSTFLAGS="-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" export RUSTDOCFLAGS="-Cpanic=abort" -export LLVM_PROFILE_FILE="${PROFRAW_DIR}/coverage-%4m.profraw" +export LLVM_PROFILE_FILE="${PROFRAW_DIR}/coverage-%p-%m.profraw" # Disable expanded command printing for the rest of the program set +x @@ -108,7 +138,7 @@ for UTIL in ${UTIL_LIST}; do fi echo "## Clear the trace directory to free up space" - rm -rf "${PROFRAW_DIR}" && mkdir -p "${PROFRAW_DIR}" + prepare_profraw_dir done; echo "Running coverage tests over uucore" From 62af949d2c5ee7a6df2798d29e0447876b1e8a29 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 22 Jul 2026 11:11:44 +0000 Subject: [PATCH 2/3] fix(ci): satisfy Style/spelling for coverage ACL comment Avoid the unknown word profraw in CICD.yml and ignore setfacl/profraw in the workflow spell-checker header. Signed-off-by: Alex Chen --- .github/workflows/CICD.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index bcf3cd796f7..9182c3a2c3e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -2,9 +2,9 @@ name: CICD # spell-checker:ignore (abbrev/names) CACHEDIR CICD CodeCOV MacOS MinGW MSVC musl taiki # spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS CLEVEL nodocs -# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata +# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata profraw # spell-checker:ignore (people) Peltoche rivy Anson dawidd -# spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libcrypto libfuse libssl limactl nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs zstd +# spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libcrypto libfuse libssl limactl nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache setfacl utmpdump xargs zstd # spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils defconfig DESTDIR gecos getenforce gnueabihf issuecomment maint manpages msys multisize noconfirm nofeatures nullglob onexitbegin onexitend pell runtest tempfile testsuite toybox uutils libsystemd codspeed wasip libexecinfo env: @@ -772,7 +772,7 @@ jobs: case '${{ matrix.job.os }}' in ubuntu-latest) # selinux and systemd headers needed to build tests - # acl: setfacl for coverage profraw dir default ACL (umask 0777 tests) + # acl: setfacl for coverage profile-trace dir default ACL (umask 0777 tests) sudo apt-get -y update sudo apt-get -y install libselinux1-dev libsystemd-dev acl # pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd. From 6c62e759c79d0ed525627dfceed0208e165273df Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 22 Jul 2026 19:32:41 +0000 Subject: [PATCH 3/3] fix(ci): keep coverage ACL with bounded %4m profraw pool Default ACL still keeps umask(0777) profiles owner-writable, but restore LLVM's online-merge pool (%4m) instead of one file per process. Signed-off-by: Alex Chen --- util/build-run-test-coverage-linux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/build-run-test-coverage-linux.sh b/util/build-run-test-coverage-linux.sh index 5ac8e12762e..4dd1d7e94d9 100755 --- a/util/build-run-test-coverage-linux.sh +++ b/util/build-run-test-coverage-linux.sh @@ -56,8 +56,8 @@ REPORT_PATH="${REPORT_DIR}/total.lcov.info" # Some tests set umask(0777) via uutests pre_exec. LLVM profile files created # under that umask can be mode 000; later writes fail with EACCES and the error # lands on utility stderr (breaks exact asserts, e.g. mkfifo). -# Default ACL keeps new .profraw files owner-writable. %p-%m avoids a shared -# %4m profile pool across processes. +# Default ACL keeps new .profraw files owner-writable. Keep LLVM's bounded +# online-merge pool (%4m) instead of one file per process (%p-%m). prepare_profraw_dir() { rm -rf "${PROFRAW_DIR}" mkdir -p "${PROFRAW_DIR}" @@ -94,7 +94,7 @@ export RUSTC_BOOTSTRAP=1 export CARGO_INCREMENTAL=0 export RUSTFLAGS="-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" export RUSTDOCFLAGS="-Cpanic=abort" -export LLVM_PROFILE_FILE="${PROFRAW_DIR}/coverage-%p-%m.profraw" +export LLVM_PROFILE_FILE="${PROFRAW_DIR}/coverage-%4m.profraw" # Disable expanded command printing for the rest of the program set +x