libeatmydata icon indicating copy to clipboard operation
libeatmydata copied to clipboard

Wrapper uses readlink -f which is not supported on all versions of macOS

Open johnsonjh opened this issue 2 years ago • 3 comments

The eatmydata wrapper uses readlink -f which is not supported on all versions of macOS - the simplest workaround is to use readlink from coreutils.

I will take a look further at the usage in the script and see if an alternative that does not require any dependencies could be possible unless someone beats me to it.

johnsonjh avatar Jul 27 '22 20:07 johnsonjh

I don't know the exact versions where -f is supported, but the failure noted was from Homebrew's CI on ARM64 macOS 11.

39DE0B5C-57C4-4AAC-A1FD-24BFDE469AEE

johnsonjh avatar Jul 27 '22 20:07 johnsonjh

Perhaps realpath -e would work here.

As with readlink, since this is non-POSIX, I'd need to check if it's widely supported ...

johnsonjh avatar Jul 27 '22 21:07 johnsonjh

FYI, http://mywiki.wooledge.org/BashFAQ/029

tl;dr: You can use perl:

perl -le 'print readlink "/bin/sh"'

or find with printf %l:

$ find /bin/ -type l -printf '%p points to %l\n'
/bin/sh points to bash
/bin/bunzip2 points to bzip2

or write a custom function (that is a little gnarly--see the link for it).

jjwatt avatar Jan 30 '23 12:01 jjwatt