-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
std::fs::copy causes extra AppleDouble sidecar ._ files on exFAT due to COPYFILE_ALL #154692
Copy link
Copy link
Open
Labels
A-filesystemArea: `std::fs`Area: `std::fs`C-bugCategory: This is a bug.Category: This is a bug.O-appleOperating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS)Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS)O-macosOperating system: macOSOperating system: macOST-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Metadata
Metadata
Assignees
Labels
A-filesystemArea: `std::fs`Area: `std::fs`C-bugCategory: This is a bug.Category: This is a bug.O-appleOperating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS)Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS)O-macosOperating system: macOSOperating system: macOST-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Type
Fields
Give feedbackNo fields configured for issues without a type.
std::fs::copyon an exFAT drive creates._AppleDouble sidcar files if there are any extended attributes on files, as it usesCOPYFILE_ALL. This problem was first reported in uv: astral-sh/uv#18790.rust/library/std/src/sys/fs/unix.rs
Line 2449 in 05cda35
This is different from python, which uses
COPYFILE_DATAforshutil.copyinstead:https://github.com/python/cpython/blob/12828e5f98a47864e3f6d25fdd99c062fae28b1c/Lib/shutil.py#L319.
This is a problem extracting and then copying a directory, where there's suddenly extra files in the tree that shouldn't be there (astral-sh/uv#18790). We would like to retain the mode (specifically, the executable bit), but avoid having extra files that cause problem in a walkdir-and-copy scheme. I couldn't find any discussion on
COPYFILE_ALLin #58901 (CC @ebarnard), hence I'm opening this issue.This LLM-written script reproduces this on my macOS VM. It shows how
std::fs::copycreates the sidecar file:Tested on 1.94.1, but the relevant code is in main (05cda35).