Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#53770 - emptydirs runs too early
Attached to Project:
Pacman
Opened by Luke Shumaker (lukeshu) - Monday, 24 April 2017, 01:26 GMT
Last edited by Allan McRae (Allan) - Tuesday, 29 December 2020, 13:40 GMT
Opened by Luke Shumaker (lukeshu) - Monday, 24 April 2017, 01:26 GMT
Last edited by Allan McRae (Allan) - Tuesday, 29 December 2020, 13:40 GMT
|
DetailsSummary and Info:
The tidy_remove hooks are run in sorted-filename order. This means that, several other remove hooks are run after tidy_emptydirs (namely, tidy_libtools, tidy_purge, and tidy_staticlibs). Each of these may remove files, making a directory empty; and tidy_emptydirs would like to be able to remove them. Steps to Reproduce: Make the 'perl-mldbm' package from AUR. Note that despite the '!emptydirs' being included in options, that there are several empty directories under '/usr/lib'. This is because with the default PURGE_TARGETS value, tidy_purge wipes out every file that perl-mldbm places under '/usr/lib' ('.packlist', and '*.pod') The obvious solution would be to put "NN-" prefixes on the tidy hook filenames, and give emptydirs.sh a high NN. |
This task depends upon
An alternative solution would be to have e.g. tidy_remove_late() for hooks which depend on the actions of other hooks, and fit tidy_emptydirs() there instead.
I know Allan has been talking about "makepkg drop-ins", but I don't think anything about /usr/share/makepkg/tidy/ is documented. I don't see as much of a problem changing an undocumented interface.
I also agree with Anton. I'd be very surprised if there are any locales that sort Arabic numerals differently (I'm figuring out how to parse /usr/share/i18n/locales/ to verify that). And even if there are, just save/restore LC_COLLATE and LC_ALL around the "$LIBRARY/tidy/"*.sh glob.
The problem with just doing undocumented fixes for this is that future refactoring might accidentally break it because it's not obvious that it matters. I'm not worried about *breaking* an interface (that is already broken).
If everything else is "10-" and emptydirs is "99-", that's a good hint that "maybe this needs to run later". Even more so if you add a comment saying "this must run late because other tidy_remove hooks might remove files making a directory empty".
- tidy_remove+=('tidy_emptydirs')
+ tidy_modify+=('tidy_emptydirs')
Since modify rules are run after remove rules - emptydirs will run after all remove rules are run.
We can add a comment in code stating that emptydirs is added in modify rules to make sure it runs after all remove rules.