Post

Replies

Boosts

Views

Activity

`Bad file descriptor` when copying using hardlink flag
When I try to link a file on macOS, I get: $ cp -l release-source/release/examples/stubs-1-pubsub.test.js . cp: ./stubs-1-pubsub.test.js: Bad file descriptor This made it seem like the copying failed, but ls shows it went fine: $ ls -li release-source/release/examples/stubs-1-pubsub.test.js stubs-1-pubsub.test.js 9825657 -rw-r--r-- 2 carlerik staff 1072 26 sep 16:24 release-source/release/examples/stubs-1-pubsub.test.js 9825657 -rw-r--r-- 2 carlerik staff 1072 26 sep 16:24 stubs-1-pubsub.test.js A related post talks about this error coming from the file system, not the cp util itself. Creating a hard link using the ln command works fine, so the error must be due to something cp does that ln does not, so I fired up the console and captured messages hoping to see something. I cannot see that I do ... Does anyone have an idea what this is caused by? System information ❯ npx envinfo --system System: OS: macOS 13.5.2 CPU: (12) arm64 Apple M2 Max Memory: 4.24 GB / 64.00 GB Shell: 5.2.15 - /opt/homebrew/bin/bash ❯ diskutil list /dev/disk0 (internal, physical): #: 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
3
2
1.8k
Sep ’23