dh_installsystemd and Also= directive (about perl filetest operators)
niels at thykier.net
Mon Jun 11 07:04:00 BST 2018
> please keep me in Cc, I'm not subscribed to the list.
> I'm implementing user units support in dh_installsystemd. For doing so
> the code needs a bit of refactoring and thus I'm trying to understand
> how the tool is supposed to operate and adding some tests to check that
> nothing will break in the process.
Thanks for working in improving debhelper and particular improving its
testsuite in the process. :)
> [...] However, in the case of symlinks
> execution never goes past the 'return unless -f $name' test and %aliases
> is never populated.
The "-f" test returns true for any file or symlink to a file by default:
$ touch foo
$ ln -s foo bar
$ perl -E 'say "file" if -f "bar"'
$ perl -E 'say "file" if -f "foo"'
Assuming you are familiar with stat(2) and lstat(2), then it might help
to think of "-f/-d/-x" as "do a stat(2) and check the file type after
that" with "-l" being one of the few operators that uses "lstat(2)"
instead (for, hopefully obvious, reasons).
The perldoc from "perldoc -f -X" is not particularly clear on this.
This give away is when it talks about reusing results from stat
("solitary underline") where they remind you that -l uses lstat instead
of stat in a bracket.
I think this answered the questions of this email: If you feel that a
question was left unanswered, please let me know.
More information about the Pkg-systemd-maintainers