uutils / uutils/coreutils

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

Open
#8,453 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P - MacOS U - cp
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test_cp::test_cp_from_stdin and test_cp::test_cp_from_stream_permission in tests/by-util/test_cp.rs, where both failures involve /dev/fd/0 on macOS. Run these tests on the affected macOS targets and inspect how the cp command receives the stream. Done means both tests reliably succeed without the Bad file descriptor failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.