You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observed while bootstrapping a Cygwin package tree (MSYS2-packages fork)
Description
On Cygwin/MSYS2, cp -a / cp -arf attempts to preserve extended attributes via the Rust xattr crate. Cygwin does not support xattrs the way Linux does, so every file copied with archive mode produces stderr noise:
cp: setting attributes for '/usr/bin/cygwin1.dll': unsupported platform, please file a bug at `https://github.com/Stebalien/xattr'
cp: setting attributes for '/usr/include/aio.h': unsupported platform, please file a bug at `https://github.com/Stebalien/xattr'
...
GNU cp -a on the same system does not emit these messages and completes successfully.
This is related to #9704 (cp -p / -a preserving xattrs when GNU does not), but the Cygwin case is worse because:
Volume: thousands of warnings when copying a full /usr tree.
Hard failure: merging an existing directory tree can abort with a non-GNU error:
cp -arf src/usr dest/ should merge into existing dest/usr/ like GNU cp, not fail with File exists (os error 17).
Actual behavior
cp -a tries to set xattrs via the xattr crate on every file.
Cygwin returns "unsupported platform" for each attempt (stderr spam).
Directory-tree merges that GNU handles can fail with File exists (os error 17).
Impact
Breaks POSIX shell scripts that use cp -arf to overlay package trees onto existing directories -- common in bootstrap/build scripts. Workaround is to use tar pipes instead of cp.
uutils/coreutils issue
Filed: #12958
Component
cpEnvironment
MSYSTEM=CYGWIN)uutils-coreutils(providescoreutils)Description
On Cygwin/MSYS2,
cp -a/cp -arfattempts to preserve extended attributes via the Rustxattrcrate. Cygwin does not support xattrs the way Linux does, so every file copied with archive mode produces stderr noise:GNU
cp -aon the same system does not emit these messages and completes successfully.This is related to #9704 (
cp -p/-apreserving xattrs when GNU does not), but the Cygwin case is worse because:/usrtree.GNU
cp -arfmergesusr/into an existingdest/usr/without error.Steps to reproduce
1. xattr warnings
On affected systems, copying real package trees (hundreds of headers/DLLs) floods stderr with
unsupported platformxattr messages.Minimal bootstrap example:
2. directory merge failure (EEXIST)
mkdir -p /tmp/cp-merge/{dest-install/usr/bin,dest/usr/bin} echo new > /tmp/cp-merge/dest-install/usr/bin/gcc.exe echo old > /tmp/cp-merge/dest/usr/bin/gcc.exe echo old > /tmp/cp-merge/dest/usr/bin/cpp.exe cp -arf /tmp/cp-merge/dest-install/* /tmp/cp-merge/dest/ # uutils: cp: File exists (os error 17) # GNU cp: succeeds, overwrites files inside dest/usr/Expected behavior
Match GNU coreutils on Cygwin:
cp -ashould not attempt xattr preservation unless--preserve=xattris given (see cp -p preserves extended attributes #9704).cp -arf src/usr dest/should merge into existingdest/usr/like GNUcp, not fail withFile exists (os error 17).Actual behavior
cp -atries to set xattrs via thexattrcrate on every file.File exists (os error 17).Impact
Breaks POSIX shell scripts that use
cp -arfto overlay package trees onto existing directories -- common in bootstrap/build scripts. Workaround is to usetarpipes instead ofcp.Suggested fix
xattrin the default preserve set for-aon any platform (align with GNU; cp -p preserves extended attributes #9704).target_os = "cygwin"), treat xattr as unsupported: skip preservation entirely unless explicitly requested.xattrcrate errors on unsupported platforms (no stderr per file).cp -arf foo/bar dest/works whendest/bar/already exists (GNU semantics).References