Re: `cp -l` doesn't work correctly on some macOS versions

Russ Allbery <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Organization The Eyrie
Message-ID <[email protected]>
Werner LEMBERG <[email protected]> writes:

> I'm shocked to read in

>   https://apple.stackexchange.com/questions/464706/why-do-i-get-bad-file-descriptor-when-copying-using-hardlink-flag

> that `cp -l` fails for recent macOS versions – a LilyPond user just
> confirmed that, too...

> What do you recommend to test for and/or to circumvent the issue?

I thought ln <target> <link> || ln -s <target> <link> was the standard
recipe here (in other words, fall back on symbolic links).  One has to be
very careful with how the paths are specified, though, because <target>
has a different meaning for ln -s than for ln.

(Note that even on modern systems, hard links are only reliably usable
within the same directory.  The example in the Stack Exchange question is
hard-linking to a different directory, which I would expect to fail in
lots of situations, such as on AFS file systems.)

-- 
Russ Allbery ([email protected])             <https://www.eyrie.org/~eagle/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.