gitconfig file truncated in new git revision

Nils Breunese nils at breun.nl
Sat May 15 18:42:18 UTC 2021


Gregory Anders <greg at gpanders.com> wrote:

> I submitted a PR to the git port [1] that creates a global gitconfig file at /opt/local/etc/gitconfig when the credential_osxkeychain variant is enabled. I noticed today that when I installed the new version, the file was created but had no contents:
> 
>    $ ls -l /opt/local/etc/gitconfig
>    -rw-r--r--  1 root  admin  0 May 15 11:48 /opt/local/etc/gitconfig
>    $ cat /opt/local/etc/gitconfig
>    $
> 
> And indeed, the file in the tbz2 archive is empty as well:
> 
>    $ mkdir ~/tmp
>    $ tar -C ~/tmp -xf /opt/local/var/macports/software/git/git-2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28.darwin_18.x86_64.tbz2
>    $ cat ~/tmp/opt/local/etc/gitconfig
>    $
> 
> However, if I run `sudo port -k install git` and inspect the destroot directory, the file has the correct contents:
> 
>    $ cat /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_git/git/work/destroot/opt/local/etc/gitconfig
>    [credential]
>            helper = osxkeychain
> 
> For some reason during the install phase the file is being truncated. Bizarrely, if I uninstall and reinstall the port from the existing destroot, the file then has the correct contents:
> 
>    $ sudo port uninstall git
>    $ sudo port -k install git
>    --->  Computing dependencies for git.
>    --->  Installing git at 2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28
>    Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_git/git/work/destroot" && /usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/local/var/macports/software/git/git-2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28.darwin_18.x86_64.tbz2
>    ...
>    --->  Activating git @2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28
>    ...
>    $ cat /opt/local/etc/gitconfig
>    [credential]
>            helper = osxkeychain
> 
> Anyone have any idea why this is happening? Can anyone reproduce this?

I just upgraded (git-2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28.darwin_20.x86_64.tbz2) and /opt/local/etc/gitconfig is also an empty file on my system:

~ % ls -l /opt/local/etc/gitconfig
-rw-r--r--  1 root  admin  0 15 mei 20:27 /opt/local/etc/gitconfig

~ % mkdir tmp
~ % tar -C tmp -xf /opt/local/var/macports/software/git/git-2.31.1_1+credential_osxkeychain+diff_highlight+doc+pcre+perl5_28.darwin_20.x86_64.tbz2
~ % ls -l tmp/opt/local/etc/gitconfig
-rw-r--r--  1 breun  staff  0 15 mei 20:27 tmp/opt/local/etc/gitconfig

After reinstalling the file is still empty on my system:

~ % sudo port uninstall git
~ % sudo port -k install git
(…)
% ls -l /opt/local/etc/gitconfig
~ -rw-r--r--  1 root  admin  0 15 mei 20:38 /opt/local/etc/gitconfig

~ % sw_vers
ProductName:	macOS
ProductVersion:	11.3.1
BuildVersion:	20E241

Nils.



More information about the macports-dev mailing list