Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#72167 - [makepkg] ~/.gitconfig affects git actions during package build

Attached to Project: Pacman
Opened by Pekka Ristola (pekkarr) - Saturday, 18 September 2021, 13:45 GMT
Task Type Bug Report
Category makepkg
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 6.0.0
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Summary and Info:
User's ~/.gitconfig affects the package build process when git sources are present.
In some cases makepkg might fail because of user's incompatible git configuration.

This becomes a problem when PKGBUILD has git-lfs repos as sources and user has installed
git-lfs filters in their ~/.gitconfig, see [1]. Makepkg should instead work independently
of user's git configuration.

Tested with pacman 6.0.1-2.

Steps to Reproduce:
1. Build the following PKGBUILD, which should work just fine.
2. Install git-lfs and run `git lfs install` in your home directory to put git-lfs filters in your ~/.gitconfig.
3. Try building the package again with `makepkg -fcC`. This time makepkg fails to checkout the git repo because of git-lfs filters. Output is provided at the end of the report.
(git-lfs filters can be removed with `git lfs uninstall`)

Git provides environment variables GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM to set the location of configuration files.
Setting these to /dev/null causes git to use the default configuration which resolves the issue.
See man page git(1) for details.


Output of failed build of the example PKGBUILD:
$ makepkg -fcC
==> Making package: example 1-1 (Sat Sep 18 16:04:30 2021)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating makehuman-assets git repo...
Fetching origin
==> Validating source files with md5sums...
makehuman-assets ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
-> Creating working copy of makehuman-assets git repo...
Cloning into 'makehuman-assets'...
Downloading base/clothes/fedora01/materials/fedora_displacement.png (58 KB)
Error downloading object: base/clothes/fedora01/materials/fedora_displacement.png (eee2064): Smudge error: Error downloading base/clothes/fedora01/materials/fedora_displacement.png (eee2064ddeede30f111197d88f3960a56d74cfc81478e8884245d3d5e7485c1b): error transferring "eee2064ddeede30f111197d88f3960a56d74cfc81478e8884245d3d5e7485c1b": [0] remote missing object eee2064ddeede30f111197d88f3960a56d74cfc81478e8884245d3d5e7485c1b

Errors logged to /home/user/example/src/makehuman-assets/.git/lfs/logs/20210918T160431.008002783.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: base/clothes/fedora01/materials/fedora_displacement.png: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

==> ERROR: Failure while creating working copy of makehuman-assets git repo
This task depends upon

Comment by Emil (xexaxo) - Tuesday, 21 September 2021, 16:40 GMT
AFAICT this is working as intended. One should be building packages in clean environment and if ~/.gitconfig was explicitly added then it should be honoured.

"Fixing" this in makepkg is essentially a hack IMHO.