FS#53136 - alpm-hooks should allow to restrict a Type=File trigger to certain file types

Attached to Project: Pacman
Opened by Stefan Majewsky (majewsky) - Wednesday, 01 March 2017, 22:44 GMT
Task Type Feature Request
Category General
Status Assigned
Assigned To Andrew Gregory (andrewgregory)
Architecture All
Severity Low
Priority Normal
Reported Version 5.0.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I noticed this with the update to screen-4.5.1-1. It contains the directory /usr/share/info/, but nothing below it.

$ pacman -Qql screen | grep info
/usr/share/info/

Upon installation, the texinfo-install.hook from texinfo-6.3-1 fires, because its trigger looks like this:

$ cat /usr/share/libalpm/hooks/texinfo-install.hook
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = usr/share/info/*

[Action]
Description = Updating the info directory file...
When = PostTransaction
Exec = /bin/sh -c 'while read -r f; do install-info "$f" /usr/share/info/dir 2> /dev/null; done'
NeedsTargets

The trigger fails because `install-info` expects a file argument, not a directory argument. The error actually occurs for all packages with info files, since they all contain /usr/share/info/, but since there are actual files after that package entry, the error remains unnoticed in this particular instance.

I could file a bug against the texinfo package to have a strategic `test -f` added to that Exec= line, or to have the glob changed to Target=usr/share/info/?*, but IMO the problem is with Pacman. It's really surprising that a trigger of Type=File fires for directories as well. There should be trigger types that trigger only for certain file types. At the very least, it seems like one type of trigger for any type of filesystem entry, and another trigger type for non-directories would be useful.
This task depends upon

Comment by Allan McRae (Allan) - Thursday, 02 March 2017, 01:27 GMT
Doesn't using usr/share/info/.* work?
Comment by Andrew Gregory (andrewgregory) - Thursday, 02 March 2017, 01:29 GMT
I am not inclined to change this. Directories can already be easily excluded with correct Targets and changing the meaning of 'Type = File' would break existing hooks that expect both.
Comment by Eli Schwartz (eschwartz) - Thursday, 02 March 2017, 02:06 GMT
The Target for these particular hooks should anyways be:

Target = usr/share/info/*.info*

Because it matches the expected info file names, rather than blindly matching on the directory. Two [core] packages, in fact, install PNG files in there for some odd reason (gnutls and libidn), and it is wasteful to whatever minor degree, to attempt to run `install-info` on those files.

Loading...