From 6efd156b16dc38a254ae4f00c3427738d9828e45 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Thu, 15 Oct 2026 16:59:40 +0800 Subject: [PATCH] gh-159452: Run the regen-configure container as the invoking user Tools/build/regen-configure.sh ran the autoconf container as root, so it left a root-owned autom4te.cache/ in the source tree. The invoking user could neither write into it (making a later `make autoconf` fail with "cannot open autom4te.cache/requests: Permission denied") nor delete it (making `git clean -xdf` warn for every file in it). Run the container as the invoking user, and purge autom4te.cache before and after the run from inside the container, so leftovers owned by root are also removed without needing sudo. --- .../Build/2026-10-15-17-19-41.gh-issue-159452.oJ1saO.rst | 3 +++ Tools/build/regen-configure.sh | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2026-10-15-17-19-41.gh-issue-159452.oJ1saO.rst diff --git a/Misc/NEWS.d/next/Build/2026-10-15-17-19-41.gh-issue-159452.oJ1saO.rst b/Misc/NEWS.d/next/Build/2026-10-15-17-19-41.gh-issue-159452.oJ1saO.rst new file mode 100644 index 000000000000000..54ec38f694b2400 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-10-15-17-19-41.gh-issue-159452.oJ1saO.rst @@ -0,0 +1,3 @@ +``Tools/build/regen-configure.sh`` no longer leaves an ``autom4te.cache`` +directory owned by root in the source tree: the Autoconf container now runs as +the invoking user, and the cache is removed when the script finishes. diff --git a/Tools/build/regen-configure.sh b/Tools/build/regen-configure.sh index c7683eb36763aff..fb16e4f0436ef4c 100755 --- a/Tools/build/regen-configure.sh +++ b/Tools/build/regen-configure.sh @@ -26,4 +26,11 @@ if command -v selinuxenabled >/dev/null && selinuxenabled; then PATH_OPT=":Z" fi -"$RUNTIME" run --rm -v "$abs_srcdir:$WORK_DIR$PATH_OPT" "$IMAGE" +purge_autom4te_cache() { + "$RUNTIME" run --rm -v "$abs_srcdir:$WORK_DIR$PATH_OPT" \ + --entrypoint sh "$IMAGE" -c "rm -rf $WORK_DIR/autom4te.cache" +} + +purge_autom4te_cache +trap purge_autom4te_cache EXIT +"$RUNTIME" run --rm -u "$(id -u):$(id -g)" -v "$abs_srcdir:$WORK_DIR$PATH_OPT" "$IMAGE"