[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `cp -l` doesn't work correctly on some macOS versions
From: |
Russ Allbery |
Subject: |
Re: `cp -l` doesn't work correctly on some macOS versions |
Date: |
Fri, 02 Feb 2024 12:20:12 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Werner LEMBERG <wl@gnu.org> 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 (eagle@eyrie.org) <https://www.eyrie.org/~eagle/>