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"