Gentoo Archives: gentoo-dev

From: Florian Schmaus <flow@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] git-r3.eclass: Add checkout dirs as "safe" directories
Date: Sun, 06 Nov 2022 15:08:52
Message-Id: 45824bf4-de57-55d9-d4f4-7f3dc9861075@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] git-r3.eclass: Add checkout dirs as "safe" directories by "Michał Górny"
1 On 06.11.22 12:38, Michał Górny wrote:
2 > On Sun, 2022-11-06 at 12:19 +0100, Florian Schmaus wrote:
3 >> On 06.11.22 12:03, Michał Górny wrote:
4 >>> Mark all checkout directories as "safe" to avoid dubious ownership
5 >>> errors with newer git versions when the checkout directory is accessed
6 >>> from src_install().
7 >>>
8 >>> Bug: https://bugs.gentoo.org/879353
9 >>> Signed-off-by: Michał Górny <mgorny@g.o>
10 >>> ---
11 >>> eclass/git-r3.eclass | 5 +++++
12 >>> 1 file changed, 5 insertions(+)
13 >>>
14 >>> diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
15 >>> index 59d4f9a0038f..bdb28565e2f9 100644
16 >>> --- a/eclass/git-r3.eclass
17 >>> +++ b/eclass/git-r3.eclass
18 >>> @@ -887,6 +887,11 @@ git-r3_checkout() {
19 >>> cp "${orig_repo}"/packed-refs "${GIT_DIR}"/packed-refs || die
20 >>> fi
21 >>>
22 >>> + # mark this directory as "safe" so that src_install() can access it
23 >>> + # https://bugs.gentoo.org/879353
24 >>> + git config --global --add safe.directory \
25 >>> + "$(cd "${out_dir}" && echo "${PWD}")" || die
26 >>
27 >> I guess there is no way we can avoid the --global and use --local instead?
28 >>
29 >
30 > safe.directory works only in protected scoeps, i.e. system, global and
31 > command. See git-config(1).
32 >
33 > That said, the check wouldn't really make sense if the repository were
34 > able to declare itself safe.
35
36
37 Fair point, and I suspected as much.
38
39 Am I right that this does modify ~portage/.gitconfig (so usually
40 /var/lib/portage/home/.gitconfig)? If so, I wonder if this could be
41 avoided, e.g., by setting XDG_CONFIG_HOME to $T/.config. But I guess
42 that has the potential to break other things. And having some eclass
43 modifying the home directory of the portage user is not probably
44 something we could live with. It would just we be nice if the
45 save.directory setting would be just temporary during the emerge, e.g.,
46 set somewhere under T.
47
48 - Flow

Replies