Hello, TL;DR: could I ask for a flag that would make `cp --link` not use hardlinks in case the file copied is a symlink?
Some background: A user of my script (which calls `cp --archive --link` under the hood, on a directory which contains symlinks) reported recently that it does not work on a MacOS filesystem. The user was running it in a Linux docker container on top of a MacOS system (docker actually uses a VM to run Linux in that case), where the filesystem was mounted from the host MacOS system. The script, when effectively running `cp --archive --link source-dir destination-dir` failed after printing: cp: cannot create hard link 'destination-dir/mnist' to 'source-dir/mnist': Operation not permitted cp: cannot create hard link 'destination-dir/mnist.npz' to 'source-dir/mnist.npz': Input/output error In that case "source-dir/mnist" was a symlink to a directory, and "source-dir/mnist.npz" was a symlink to a regular file. This was really surprising to me, and after some investigation it turned out that even the native MacOS `ln` is not able to make a hardlink of a symlink. I'm guessing this is some kind of MacOS limitation and/or design choice, and not likely to change any time soon. I wonder if GNU `cp` could be made to somehow work in this situation? One way would be to add an additional option, which would make `--link` create symlinks to the target, rather than a hardlink, if the file in question is itself a symlink. regards, -- Marcin Owsiany <mar...@owsiany.pl> http://marcin.owsiany.pl/ GnuPG: 4096R/CDFB68E9 59F4 A7DE D37D 95C5 8939 FDDB EFDE D44B CDFB 68E9