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#58865 - makepkg fails to set $BUILDDIR correctly if $startdir contains symlinks

Attached to Project: Pacman
Opened by A. Bosch (progandy) - Monday, 04 June 2018, 12:42 GMT
Last edited by Allan McRae (Allan) - Tuesday, 19 June 2018, 10:36 GMT
Task Type Bug Report
Category makepkg
Status Closed
Assigned To Eli Schwartz (eschwartz)
Architecture All
Severity Low
Priority Normal
Reported Version 5.1.0
Due in Version 5.1.1
Due Date Undecided
Percent Complete 100%
Votes 2
Private No


Summary and Info:
makepkg sets $startdir to $PWD without resolving symlinks.
$BUILDDIR is set to the canonical path without symlinks.
If $startdir contains symlinks, these two paths differ and makepkg erroneously appends $pkgbase to the BUILDDIR.
This is especially bad if the package contains a file with the same name as it results in an error:

==> Making package: foo 1-1 (2018-06-04 ...)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
mkdir: cannot create directory ‘/tmp/aurbuild/foo/foo’: Not a directory

==> ERROR: An unknown error has occurred. Exiting...

A possible fix would be to initialize $startdir with $(pwd -P) or add it to the canonicalize_path loop.

Steps to Reproduce:

$ mkdir -p /tmp/aurbuild/foo
$ cd /tmp/aurbuild/
$ ln -s foo link
$ touch foo/foo
$ cat >foo/PKGBUILD <<PKGBUILD-end
build() { false; }
package() { false; }
$ cd link
$ makepkg
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 19 June 2018, 10:36 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit 79320234