Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@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 11:38:54
Message-Id: b4eb79f251a926f29e90f2cfaca999fde7b813b8.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] git-r3.eclass: Add checkout dirs as "safe" directories by Florian Schmaus
1 On Sun, 2022-11-06 at 12:19 +0100, Florian Schmaus wrote:
2 > On 06.11.22 12:03, Michał Górny wrote:
3 > > Mark all checkout directories as "safe" to avoid dubious ownership
4 > > errors with newer git versions when the checkout directory is accessed
5 > > from src_install().
6 > >
7 > > Bug: https://bugs.gentoo.org/879353
8 > > Signed-off-by: Michał Górny <mgorny@g.o>
9 > > ---
10 > > eclass/git-r3.eclass | 5 +++++
11 > > 1 file changed, 5 insertions(+)
12 > >
13 > > diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
14 > > index 59d4f9a0038f..bdb28565e2f9 100644
15 > > --- a/eclass/git-r3.eclass
16 > > +++ b/eclass/git-r3.eclass
17 > > @@ -887,6 +887,11 @@ git-r3_checkout() {
18 > > cp "${orig_repo}"/packed-refs "${GIT_DIR}"/packed-refs || die
19 > > fi
20 > >
21 > > + # mark this directory as "safe" so that src_install() can access it
22 > > + # https://bugs.gentoo.org/879353
23 > > + git config --global --add safe.directory \
24 > > + "$(cd "${out_dir}" && echo "${PWD}")" || die
25 >
26 > I guess there is no way we can avoid the --global and use --local instead?
27 >
28
29 safe.directory works only in protected scoeps, i.e. system, global and
30 command. See git-config(1).
31
32 That said, the check wouldn't really make sense if the repository were
33 able to declare itself safe.
34
35 --
36 Best regards,
37 Michał Górny

Replies