Home Apple terminal – Why do I get `Dangerous file descriptor` when copying utilizing hardlink flag?

terminal – Why do I get `Dangerous file descriptor` when copying utilizing hardlink flag?

0
terminal – Why do I get `Dangerous file descriptor` when copying utilizing hardlink flag?

[ad_1]

Each occasionally I discover that I want to make use of the -rl choices of cp to clone a listing tree utilizing hardlinks. This has at all times labored positive on Linux, and I can see that the BSD cp command accepts the identical choices. When I attempt to hyperlink a file on macOS, I get:

cp -l  release-source/launch/examples/stubs-1-pubsub.check.js .
cp: ./stubs-1-pubsub.check.js: Dangerous file descriptor

This made it look like the copying failed, however ls exhibits it went positive:

ls -li  release-source/launch/examples/stubs-1-pubsub.check.js stubs-1-pubsub.check.js
9825657 -rw-r--r--  2 carlerik  employees  1072 26 sep 16:24 release-source/launch/examples/stubs-1-pubsub.check.js
9825657 -rw-r--r--  2 carlerik  employees  1072 26 sep 16:24 stubs-1-pubsub.check.js

So … what’s going on?

System info

❯ npx envinfo --system

  System:
    OS: macOS 13.5.2
    CPU: (12) arm64 Apple M2 Max
    Reminiscence: 4.24 GB / 64.00 GB
    Shell: 5.2.15 - /choose/homebrew/bin/bash

❯ diskutil listing
/dev/disk0 (inside, bodily):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk0
   1:             Apple_APFS_ISC Container disk1         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk3         2.0 TB     disk0s2
   3:        Apple_APFS_Recovery Container disk2         5.4 GB     disk0s3

[ad_2]