Skip to content

Windows: run_from_args_propagates_find_exit_status compares rtk against a different find — std resolves System32's find.exe before PATH #4610

Open

Description

@KuSh

run_from_args_propagates_find_exit_status (src/cmds/system/find_cmd.rs) builds its oracle with a bare std::process::Command::new("find") and compares its exit code with rtk's:

let argv = ["/definitely/missing/xyz", "-mtime", "+0"];
let expected = std::process::Command::new("find")
    .args(argv)
    .output()
    .map(|o| o.status.code().unwrap_or(1))
    .unwrap_or(127);
let code = run_from_args(&args(&argv), 0).unwrap();
assert_eq!(code, expected);

On Windows the two sides can resolve different programs. std searches the system directories before PATH, so the oracle runs C:\Windows\system32\find.exe — the DOS text-search utility — which rejects /definitely/missing/xyz and exits 2. rtk resolves find through PATH and gets Git's usr\bin\find.exe, which exits 1.

thread 'cmds::system::find_cmd::tests::run_from_args_propagates_find_exit_status' panicked at
src\cmds\system\find_cmd.rs:1528:9:
assertion `left == right` failed
  left: 1
 right: 2

Confirmed directly from PowerShell on that machine: system32\find.exe → 2, Git\usr\bin\find.exe → 1.

Any machine with Git's usr\bin on PATH reproduces it. CI's Windows runner does not, because Git's usr\bin is not on its PATH and both sides then resolve to the DOS find.

Reported twice independently, on two machines and both Windows toolchains, failing the same way on develop:

This is the case .claude/rules/cli-testing.md describes under "Machine independence": a test that spawns a real process must not depend on the machine it runs on. Here it is not a tool's wording but a different binary altogether.

Fix direction: build the oracle through rtk's own resolution instead of a bare Command::new("find"), so both sides run the same program. src/core/utils.rs's resolver already honours PATH and PATHEXT.

Not covered elsewhere: #4491 makes two other environment-dependent tests machine independent (copilot_selfheal_test.rs, guard_integration_test.rs) and does not touch this one, and the lex/ stack leaves find_cmd.rs alone.

The other failure those reports mention, stream::test_read_lines_lossy_preserves_lines_after_invalid_utf8, is already tracked as #3730.

Activity

  1. rtk-wshm-sync-bot commented on Oct 16, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 95%

    Summary

    Windows test oracle for find_cmd.rs resolves System32's find.exe while rtk resolves Git's find via PATH, causing false test failures on machines with Git's usr/bin on PATH; fix by routing the oracle through rtk's own PATH/PATHEXT resolver.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/system/find_cmd.rs
    • src/core/utils.rs

    Suggested Actions

    1. Replace bare Command::new("find") oracle in find_cmd.rs:~1528 with rtk's PATH/PATHEXT resolver from src/core/utils.rs
    2. Verify fix against both reported repros: x86_64-pc-windows-gnu (PR refactor(core): make MSYS-safe child argument encoding unforgettable #4103 comments) and MSVC (fix(windows): quote glob patterns passed to MSYS children #4260 test plan)
    3. Note CI won't catch regressions here since Git's usr/bin isn't on the Windows runner's PATH
    4. Confirm unrelated to test_read_lines_lossy_preserves_lines_after_invalid_utf8 fails on develop — lone invalid byte decodes as 'π' instead of U+FFFD #3730 (stream::test_read_lines_lossy_preserves_lines_after_invalid_utf8), already tracked separate…

    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions