Skip to content

bug(id): put path:name spec is hijacked by stdin auto-detection whenever stdin is not a terminal (breaks toplevel build) #4152

Closed

Description

@dezren39

Seventh breakage in the #3720 fold chain — the second fold-switch attempt (2026-11-01 21:5x CST) failed its in-sandbox checkPhase on exactly one test:

test put_get_tests::test_put_with_custom_name ... FAILED
Command failed: ["put", "/build/.tmpVLBYe6/test.local.txt:test.custom-name"]
stderr: Error: name must be a safe relative path: /build/.tmpVLBYe6/test.local.txt:test.custom-name

Reproduced deterministically on a host: cargo test -p id --test cli_integration -- test_put_with_custom_name < /dev/null fails in 0.27s with the same error; with a terminal stdin it passes (which is how it stayed hidden — interactive runs mask it).

Root cause (src/commands/put.rs, cmd_put_multi): the stdin auto-detection

if items.len() == 1 && !stdin().is_terminal() && !from_stdin {
    let path = PathBuf::from(&items[0]);
    if !path.exists() { return cmd_put_local_stdin(name /* the whole spec */).await; }
}

checks the LITERAL spec string as a path. A path:name spec never exists as a literal path (the colon), so every non-interactive id put file:name is misrouted into stdin-content mode, and FileOps::put then rejects the whole spec as an unsafe name (leading /). With a name that passed validation it would silently store stdin under a garbage name instead.

Fix: the existence check must use the path part of the spec (parse_put_spec). Plain names and missing files keep the current stdin behavior; an existing file behind a path:name spec goes to the normal file-put loop. Blocks the #3720 fold switch (the toplevel's id checkPhase runs non-interactively by construction).

Activity

  1. added 2 commits that reference this issue on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/highImportant and time-sensitive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions