Bug 64634

Summary: Non-portable "readlink" usage
Product: Portland Reporter: Daniel Macks <dmacks>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: niederstrasser
Version: 1.1.0 rc1   
Hardware: All   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:

Description Daniel Macks 2013-05-15 13:22:23 UTC
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
Comment 1 GitLab Migration User 2019-02-16 13:35:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/66.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.