gitconfig file truncated in new git revision

Gregory Anders greg at gpanders.com
Sat May 15 18:08:52 UTC 2021


Hi all,

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?

Greg

[1]: https://github.com/macports/macports-ports/pull/10882#pullrequestreview-660169443


More information about the macports-dev mailing list