Summary
cp --attributes-only SRC DEST, where the destination's parent directory is not writable (e.g. mode 555), makes uutils cp open the destination with create(true) and .unwrap() the result. The open fails with EACCES (PermissionDenied), so the unwrap panics and the process aborts with exit code 134. GNU cp reports the error and exits 1.
Steps to reproduce
$ mkdir -p /tmp/cptest/ro && cd /tmp/cptest && echo hi > s.txt && chmod 555 ro
$ cp --attributes-only s.txt ro/n.txt
thread 'main' panicked at src/uu/cp/src/cp.rs:2389:18:
called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
$ echo $?
134
Expected behavior
Match GNU: report the error and exit non-zero without crashing.
$ /usr/bin/cp --attributes-only s.txt ro/n.txt
/usr/bin/cp: cannot create regular file 'ro/n.txt': Permission denied
$ echo $?
1
Actual behavior
uutils cp panics (Result::unwrap() on an Err) and the process aborts with exit code 134, printing a Rust panic message instead of a diagnostic.
This is an I/O-failure path — distinct from the dev-full write-error family; the failure is on the destination open, not on a write. The same site can fire on other open errors (e.g. EROFS on a read-only filesystem).
Found by our static analysis tooling.
Summary
cp --attributes-only SRC DEST, where the destination's parent directory is not writable (e.g. mode555), makes uutilscpopen the destination withcreate(true)and.unwrap()the result. The open fails withEACCES(PermissionDenied), so theunwrappanics and the process aborts with exit code 134. GNUcpreports the error and exits 1.Steps to reproduce
Expected behavior
Match GNU: report the error and exit non-zero without crashing.
Actual behavior
uutils
cppanics (Result::unwrap()on anErr) and the process aborts with exit code 134, printing a Rust panic message instead of a diagnostic.This is an I/O-failure path — distinct from the dev-full write-error family; the failure is on the destination open, not on a write. The same site can fire on other open errors (e.g.
EROFSon a read-only filesystem).Found by our static analysis tooling.