coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

macos: `test_cp::test_cp_from_stdin`/`test_cp_from_stream_permission` are flaky

Open drinkcat opened this issue 4 months ago • 2 comments

These tests fail frequently, it's quite a nuisance at this stage.

Not sure if MacOS contract about /dev/fd/0 is different than we think.

---- test_cp::test_cp_from_stdin stdout ----
bin: "/Users/runner/work/coreutils/coreutils/target/x86_64-apple-darwin/debug/coreutils"
run: /Users/runner/work/coreutils/coreutils/target/x86_64-apple-darwin/debug/coreutils cp /dev/fd/0 target

thread 'test_cp::test_cp_from_stdin' panicked at tests/by-util/test_cp.rs:6333:10:
Command was expected to succeed. code: 1
stdout = 
 stderr = cp: Bad file descriptor (os error 9)

stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
   2: uutests::util::CmdResult::success
             at ./tests/uutests/src/lib/util.rs:448:9
   3: uutests::util::UCommand::succeeds
             at ./tests/uutests/src/lib/util.rs:1998:9
   4: tests::test_cp::test_cp_from_stdin
             at ./tests/by-util/test_cp.rs:6330:5
   5: tests::test_cp::test_cp_from_stdin::{{closure}}
             at ./tests/by-util/test_cp.rs:6325:24
   6: core::ops::function::FnOnce::call_once
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/ops/function.rs:250:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    test_cp::test_cp_from_stdin
---- test_cp::test_cp_from_stream_permission stdout ----
bin: "/Users/runner/work/coreutils/coreutils/target/aarch64-apple-darwin/debug/coreutils"
touch: /var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/.tmpfd7oYw/target
symlink: /var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/.tmpfd7oYw/target,/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/.tmpfd7oYw/link
run: /Users/runner/work/coreutils/coreutils/target/aarch64-apple-darwin/debug/coreutils cp /dev/fd/0 link

thread 'test_cp::test_cp_from_stream_permission' panicked at tests/by-util/test_cp.rs:6392:10:
Command was expected to succeed. code: 1
stdout = 
 stderr = cp: Bad file descriptor (os error 9)

stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
   2: uutests::util::CmdResult::success
             at ./tests/uutests/src/lib/util.rs:448:9
   3: uutests::util::UCommand::succeeds
             at ./tests/uutests/src/lib/util.rs:1998:9
   4: tests::test_cp::test_cp_from_stream_permission
             at ./tests/by-util/test_cp.rs:6389:5
   5: tests::test_cp::test_cp_from_stream_permission::{{closure}}
             at ./tests/by-util/test_cp.rs:6378:36
   6: core::ops::function::FnOnce::call_once
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/ops/function.rs:250:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    test_cp::test_cp_from_stream_permission

drinkcat avatar Aug 09 '25 05:08 drinkcat

may be of relevance: https://github.com/uutils/coreutils/pull/7844

hz2 avatar Aug 10 '25 15:08 hz2

The tests are succeeding when I run them manually on my MacBook Pro with MacOS 15.7. (some empty lines were added in the process of copy/pasting the logs to my linux PC, those are irrelevant).

macos-test-results.txt

Ecordonnier avatar Aug 11 '25 16:08 Ecordonnier