Non-portable "readlink" usage
Submitted by Daniel Macks
Assigned to Portland Bugs
Description
Many of the xdg-utils scripts use shell commands like readlink -f $path
. However, this -f flag is only available in some flavors of the readlink command and has different meanings in some as well. For example, the (I assume) intended meaning is as in GNU readlink manpage:
-f, --canonicalize
canonicalize by following every symlink in every component of
the given name recursively; all but the last component must
exist
OS X is BSDish not GNUish. Even up through 10.7, their readlink command does not support the -f flag, and googling around doesn't find that it was added in 10.8 (or if so, that it would have the same meaning).
The immediate effect is that self-tests fail with messages such as:
readlink: illegal option -f usage: readlink [-n] [file ...]
And obviously whatever the scripts are hoping to do with the canonical version of $path won't be getting the expected string.
I can install the GNU coreutils suite (via fink, etc or manually) and get the readline that xdg-utils wants, but that's a pretty heavy dependency for such a simple set of sscripts. Here's one discussion of possible solutions:
http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
Version: 1.1.0 rc1