File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- ``Tools/build/regen-configure.sh `` no longer leaves an ``autom4te.cache ``
2- directory owned by root in the source tree: the Autoconf container now runs as
3- the invoking user, and the cache is removed when the script finishes.
1+ ``Tools/build/regen-configure.sh `` no longer leaves
2+ root-owned files in the source tree.
Original file line number Diff line number Diff line change @@ -26,11 +26,27 @@ if command -v selinuxenabled >/dev/null && selinuxenabled; then
2626 PATH_OPT=" :Z"
2727fi
2828
29+ # Run the container as the invoking user so that generated files are owned by
30+ # that user and not by root. Rootless runtimes already map root to the invoking
31+ # user, so a user mapping is only needed for rootful Docker.
32+ USER_OPT=" "
33+ case " $RUNTIME " in
34+ podman)
35+ USER_OPT=" --userns=keep-id"
36+ ;;
37+ docker)
38+ if ! docker info --format ' {{.SecurityOptions}}' | grep -q rootless; then
39+ USER_OPT=" -u $( id -u) :$( id -g) "
40+ fi
41+ ;;
42+ esac
43+
2944purge_autom4te_cache () {
45+ [ -d " $abs_srcdir /autom4te.cache" ] || return 0
3046 " $RUNTIME " run --rm -v " $abs_srcdir :$WORK_DIR$PATH_OPT " \
31- --entrypoint sh " $IMAGE " -c " rm -rf $WORK_DIR /autom4te.cache"
47+ " $IMAGE " sh -c " rm -rf $WORK_DIR /autom4te.cache"
3248}
3349
3450purge_autom4te_cache
35- trap purge_autom4te_cache EXIT
36- " $RUNTIME " run --rm -u " $( id -u ) : $( id -g ) " -v " $abs_srcdir :$WORK_DIR$PATH_OPT " " $IMAGE "
51+ trap ' purge_autom4te_cache || true ' EXIT
52+ " $RUNTIME " run --rm $USER_OPT -v " $abs_srcdir :$WORK_DIR$PATH_OPT " " $IMAGE "
You can’t perform that action at this time.
0 commit comments