Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tools/build/regen-configure.sh ran the Autoconf container as root, so Autoconf left a root-owned autom4te.cache/ in the source tree. Being a directory owned by root and mode 0755, it cannot be written to or removed by the invoking user, which breaks make autoconf afterwards (autom4te: error: cannot open autom4te.cache/requests: Permission denied) and makes git clean -xdf fail with warning: failed to remove autom4te.cache/...: Permission denied. Recovering needs sudo, which not every developer has.
Changes
Run the container as the invoking user (-u "$(id -u):$(id -g)"), so the regenerated configure, aclocal.m4 and pyconfig.h.in are not left owned by root either.
Remove $WORK_DIR/autom4te.cache before the run and from an EXIT trap, running the cleanup inside the container so that a stale cache left by an earlier root run can be removed without sudo.
The cleanup reuses the same image via --entrypoint sh, so no extra dependency (e.g. busybox) is pulled in.
Why the cache cannot simply be rm'd from the script
The invoking user has no write permission on a root-owned autom4te.cache/, so it has to be deleted as root — i.e. from inside the container. Doing it before the run also matters: a stale root-owned cache makes even the corrected, non-root run fail immediately.
Why the cache cannot simply be rm'd from the script
The invoking user has no write permission on a root-owned autom4te.cache/, so it has to be deleted as root — i.e. from inside the container. Doing it before the run also matters: a stale root-owned cache makes even the corrected, non-root run fail immediately.
issue: #159452