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 Allan McRae (Allan) - Friday, 11 October 2019, 10:25 GMT
Opened by Ethan Sommer (E5ten) - Monday, 08 April 2019, 15:19 GMT
Last edited by Allan McRae (Allan) - Friday, 11 October 2019, 10:25 GMT
|
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 |
This task depends upon
Closed by Allan McRae (Allan)
Friday, 11 October 2019, 10:25 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 6911904a
Friday, 11 October 2019, 10:25 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 6911904a
...
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.
From the sound of things, the output of ** was changed to more closely match the behavior of zsh or something.
(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.
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
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.