Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unexpected issue fetching a local git repo from an ebuild
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10662
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 02, 2024 7:46 pm    Post subject: Unexpected issue fetching a local git repo from an ebuild Reply with quote

I have a workflow I've been using for years where I create a bespoke ebuild that fetches source code from a "feature branch" (that I create) of a local git repository that is itself a clone of an upstream repository. Currently I'm working on upstream samba so I've cloned the upstream samba repo into /home/jgraham/Projects/Gentoo/samba, checked out the tag I'm interested in and created the feature branch, in this case named nss_winbind_experiments, and switched to that branch. This structure allows me to make changes in the local repo and, as soon as I commit those changes, they can be built and installed with Portage. I use versions like 9998, 9997 for my local experimental branches.

This has been working for years but in my latest attempt git is no longer happy:
Code:
terra ~ # emerge -1v =samba-9998

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
Dependency resolution took 9.84 s (backtrack: 0/30).

[ebuild     U ~] net-fs/samba-9998:0/2.10.0::JRG [4.21.1_p1:0/2.10.0::JRG] USE="acl -addc ads -ceph client -cluster cups -debug (-fam) -glusterfs -gpg -iprint -json ldap -llvm-libunwind -lmdb pam -profiling-data python -quota regedit (-selinux) -snapper -spotlight syslog (-system-heimdal) system-mitkrb5 -systemd (-test) -unwind winbind -zeroconf" ABI_X86="-32 (64) (-x32)" PYTHON_SINGLE_TARGET="-python3_10 -python3_11 python3_12 -python3_13" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB


>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-fs/samba-9998::JRG
 * Using python3.12 to build
>>> Unpacking source...
 * Repository id: home_jgraham_Projects_Gentoo_samba.git
 * To override fetched repository properties, use:
 *   EGIT_OVERRIDE_REPO_HOME_JGRAHAM_PROJECTS_GENTOO_SAMBA
 *   EGIT_OVERRIDE_BRANCH_HOME_JGRAHAM_PROJECTS_GENTOO_SAMBA
 *   EGIT_OVERRIDE_COMMIT_HOME_JGRAHAM_PROJECTS_GENTOO_SAMBA
 *   EGIT_OVERRIDE_COMMIT_DATE_HOME_JGRAHAM_PROJECTS_GENTOO_SAMBA
 *
 * Fetching file:///home/jgraham/Projects/Gentoo/samba ...
git fetch file:///home/jgraham/Projects/Gentoo/samba +refs/heads/nss_winbind_experiments:refs/heads/nss_winbind_experiments
fatal: detected dubious ownership in repository at '/home/jgraham/Projects/Gentoo/samba/.git'
To add an exception for this directory, call:

    git config --global --add safe.directory /home/jgraham/Projects/Gentoo/samba/.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Now that seems like good advice, so checking existence and access rights of my local repo I get:
Code:
terra ~ # stat /home/jgraham/Projects/Gentoo/samba/.git
  File: /home/jgraham/Projects/Gentoo/samba/.git
  Size: 12          Blocks: 17         IO Block: 131072 directory
Device: 0,32    Inode: 129304      Links: 7
Access: (0755/drwxr-xr-x)  Uid: (10000/HOME\jgraham)   Gid: (11001/HOME\domain users)
Access: 2024-12-02 13:47:42.665658596 -0500
Modify: 2024-12-02 13:46:23.286102287 -0500
Change: 2024-12-02 13:47:42.665658596 -0500
 Birth: 2024-12-02 13:44:18.226801144 -0500

terra ~ # namei -m /home/jgraham/Projects/Gentoo/samba/.git
f: /home/jgraham/Projects/Gentoo/samba/.git
 drwxr-xr-x /
 drwxr-xr-x home
 drwxr-xr-x jgraham
 drwxr-xr-x Projects
 drwxr-xr-x Gentoo
 drwxr-xr-x samba
 drwxr-xr-x .git
That looks good to me (or at least doesn't look like an impediment). Do you all see an issue?

Next I followed the other advice, creating a safe.directory exception:
Code:
terra ~ # sudo -u portage git config --global --add safe.directory /home/jgraham/Projects/Gentoo/samba/.git
but this does not appear to have any effect on the issue. I get the same error message.

The full ebuild is wgetpasted here. It's essentially the standard samba ebuild with two additions:
  • Lines 13 - 41 were added to establish custom repo or source tarball URIs depending on the version number, and
  • Lines 215 - 225 are a new src_unpack() phase function that uses either the git-r3 eclass or the default src_unpack() depending on the version number.
Any advice? (Other than to stop spitting into the wind and just fork the darned upstream repo and create my feature branches there?)

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3948

PostPosted: Mon Dec 02, 2024 8:51 pm    Post subject: Reply with quote

Unexperienced here...

Did you had previous success with EAPI 8?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2473

PostPosted: Mon Dec 02, 2024 8:51 pm    Post subject: Reply with quote

At first I thought portage sandbox must have been strengthened, but then I found this:

https://confluence.atlassian.com/bbkb/git-command-returns-fatal-error-about-the-repository-being-owned-by-someone-else-1167744132.html

The safe.directory solution should work but I'm not sure where you should put it. Is it in portage tree or your repository, it's unclear to me.

EDIT: I think it's better explained here: https://blog.echomy.com/index.php/2024/08/05/resolving-the-detected-dubious-ownership-error-in-git-an-in-depth-guide/

Best Regards,
Georgi
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10662
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 02, 2024 10:32 pm    Post subject: Reply with quote

CaptainBlood wrote:
...Did you had previous success with EAPI 8?
It was before EAPI 8 came out when I last created one of these beasts, but that turns out not to be it. See below.

logrusx wrote:
At first I thought portage sandbox must have been strengthened, but then I found this:

https://confluence.atlassian.com/bbkb/git-command-returns-fatal-error-about-the-repository-being-owned-by-someone-else-1167744132.html
...
That link gave me a clue. I was blindly applying git's recommendation, without researching the options. I was sudoing the recommended command with user "portage", because I'd verified that that was the user under which git was running, but that must've not been exactly correct. The link showed a version of the command with system-wide scope:
Code:
git config --system --add safe.directory /home/jgraham/Projects/Gentoo/samba/.git
which may not result in the least escalation of privilege, but did work. I had lazily not researched this well enough. Thanks so much for the help.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum