Bug 64634 - Non-portable "readlink" usage
Summary: Non-portable "readlink" usage
Status: RESOLVED MOVED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0 rc1
Hardware: All Mac OS X (All)
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-15 13:22 UTC by Daniel Macks
Modified: 2019-02-16 13:35 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

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.