Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 879353 - git-r3.eclass can't run git commands during the install phase with >=dev-vcs/git-2.35.2 (safe directory)
Summary: git-r3.eclass can't run git commands during the install phase with >=dev-vcs/...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-11-03 15:15 UTC by Sebastian Parborg
Modified: 2022-11-07 13:26 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Parborg 2022-11-03 15:15:43 UTC
Any git command run during the src_install() phase will fail with:
---
fatal: detected dubious ownership in repository at '/var/tmp/portage/media-gfx/blender-9999/work/blender-9999'

To add an exception for this directory, call:

	git config --global --add safe.directory /var/tmp/portage/media-gfx/blender-9999/work/blender-9999
---
This is because the .git folder and its content is owned by the portage user while we are root during the install phase.

This can be reproduced but simply unpacking a git live package and running "git log" in the working directory.
Comment 1 Sebastian Parborg 2022-11-03 15:28:41 UTC
Seems like git 2.36 add this option:
git config --global --add safe.directory '*'

Then every directory on the system will be regarded as safe and will effectively disable this check.

The "safe directory" check was added in 2.35.2 do fix a security issue:
https://github.com/git-for-windows/git/security/advisories/GHSA-vw2c-22j4-2fh2

I don't think this security issue is affecting us.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-11-06 07:34:37 UTC
Could you test the patch from the linked PR?
Comment 3 Sebastian Parborg 2022-11-07 12:16:01 UTC
Seems to work fine for me.

Thanks for the fix!
Comment 4 Larry the Git Cow gentoo-dev 2022-11-07 13:26:28 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=207a50da440b7c6bea060972a7684e792c2a84fc

commit 207a50da440b7c6bea060972a7684e792c2a84fc
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2022-11-06 07:32:48 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2022-11-07 13:25:31 +0000

    git-r3.eclass: Add checkout dirs as "safe" directories
    
    Mark all checkout directories as "safe" to avoid dubious ownership
    errors with newer git versions when the checkout directory is accessed
    from src_install().
    
    Closes: https://bugs.gentoo.org/879353
    Closes: https://github.com/gentoo/gentoo/pull/28154
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/git-r3.eclass | 5 +++++
 1 file changed, 5 insertions(+)