Pacman

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.
Tasklist

FS#62278 - globstar misses directory symlinks

Attached to Project: Pacman
Opened by Ethan Sommer (E5ten) - Monday, 08 April 2019, 15:19 GMT
Last edited by Eli Schwartz (eschwartz) - Wednesday, 14 August 2019, 05:19 GMT
Task Type Bug Report
Category makepkg
Status Assigned
Assigned To Eli Schwartz (eschwartz)
Architecture All
Severity Medium
Priority Normal
Reported Version git
Due in Version 5.2.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
The new approach for finding all the files to put into the package that uses bash globstar does not include any directory symlinks, because the `printf '%s\0 **` command doesn't output them.
introduced in https://git.archlinux.org/pacman.git/commit/scripts/makepkg.sh.in?id=b5191ea140386dd9b73e4509ffa9a6d347c1b5fa

Steps to Reproduce:
Try to build any package that creates a symlink to a directory, and notice that the symlink isn't provided by the package or on the system, the thing that made me notice it was building a custom kernel PKGBUILD and the symlink in /usr/src not getting created, but I verified with other packages that create symlinks to directories.
Really simple test PKGBUILD attached
   PKGBUILD (0.2 KiB)
This task depends upon

Comment by Eli Schwartz (eschwartz) - Monday, 08 April 2019, 16:31 GMT
Based on my experimental analysis, globstar does not print any inode if it is a symlink pointing to an existing directory.

...

Apparently this broke in bash 5, see:

https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?h=bash-5.0#n604

> wwww. The `globstar' code now skips over symbolic links to directories, preventing them from being scanned twice.

Comment by Eli Schwartz (eschwartz) - Monday, 08 April 2019, 17:16 GMT
#bash has suggested that this should probably have always used **/* instead -- this seems to work on both bash 4 and 5, and I'm trying to clarify this behavior change on bug-bash, and particularly, try to get better manpage info on just what this all is supposed to do.

From the sound of things, the output of ** was changed to more closely match the behavior of zsh or something.
Comment by Eli Schwartz (eschwartz) - Monday, 08 April 2019, 17:27 GMT
P.S. Your reproduction case was confusing to me at first, because I had OPTIONS+=(!emptydirs) in my makepkg.conf. Packages which package an empty directory intentionally, should specify options=(emptydirs) in the PKGBUILD itself.
(As a result, when I first tried to build the testcase, the symlink was a broken symlink and thus packaged.)

The reproduction testcase can be more accurately described by only packaging a symlink, e.g.

package() {
mkdir -p "${pkgdir}/opt"
ln -s /usr/local/bin "${pkgdir}/opt/test-globstar"
}

Since it does not matter where the symlink is directed at (inside or outside of "$pkgdir"), only that it resolves to *a* directory.
Comment by Eli Schwartz (eschwartz) - Monday, 08 April 2019, 20:31 GMT
For context, here is the bug-bash mailing list thread I started: https://lists.gnu.org/archive/html/bug-bash/2019-04/msg00015.html

Chet Ramey has responded: "However, I agree you're right that the symlink itself should be printed. I'll take a look at that."

I suppose it might make sense to use the different glob pattern regardless, though, if only due to the rationale "support early versions of bash 5.x which contained the breaking behavior". Thoughts? I've implemented it here (although maybe I'll tweak the commit message now): https://git.archlinux.org/users/eschwartz/pacman.git/commit/?id=b835d3db01cb9fc371b65eb70ea8a75339c2a096
Comment by Allan McRae (Allan) - Monday, 08 April 2019, 21:36 GMT
Patch looks fine. Add a comment to the file explaining this is a bash-5.0+ issue.
Comment by Eli Schwartz (eschwartz) - Wednesday, 17 April 2019, 03:59 GMT
Patch is on the mailing list: https://lists.archlinux.org/pipermail/pacman-dev/2019-April/023330.html

Would be nice to have this accepted to master and then backported to [core] asap, as it results in unavoidably corrupted packages for a whole range of PKGBUILDs including core/filesystem.
EDIT: whoops, this is only broken on master anyways.

Loading...