From: Ross Burton Date: Tue, 26 Apr 2022 12:07:20 +0000 (+0100) Subject: bitbake.conf: mark all directories as safe for git to read X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~4313 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bed8e6993e7297bdcd68940aa0d47ef47120117;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git bitbake.conf: mark all directories as safe for git to read Recent git releases containing [1] have an ownership check when opening repositories, and refuse to open a repository if it is owned by a different user. This breaks any use of git in do_install, as that is executed by the (fake) root user. Whilst not common, this does happen. Setting the git configuration safe.directories=* disables this check, so that git is usable in fakeroot tasks. This can be set globally via the internal environment variable GIT_CONFIG_PARAMETERS, we can't use GIT_CONFIG_*_KEY/VALUE as that isn't present in all the releases which have the ownership check. We already set GIT_CEILING_DIRECTORIES to ensure that git doesn't recurse up out of the work directory, so this isn't a security issue. [1] https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 0e939aca4f9..1deba8d9107 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -776,10 +776,18 @@ export PKG_CONFIG_DISABLE_UNINSTALLED = "yes" export PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}" export PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}" +# Git configuration + # Don't allow git to chdir up past WORKDIR so that it doesn't detect the OE # repository when building a recipe export GIT_CEILING_DIRECTORIES = "${WORKDIR}" +# Treat all directories are safe, as during fakeroot tasks git will run as +# root so recent git releases (eg 2.30.3) will refuse to work on repositories. See +# https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 for +# further details. +export GIT_CONFIG_PARAMETERS="'safe.directory=*'" + ### ### Config file processing ###