Skip to content

shape-doctor.py: the drifted-file remediation says cp on Windows, where cp is Copy-Item and -Path reads [old] as a wildcard even when quoted — emit Copy-Item -LiteralPath on nt #105

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

Recorded, not claimed. Copilot's final review on PR #102 (2026-09-11T12:07Z), read after the merge; the row predates #102, the quoter only made the gap visible.

What is wrong. The drifted-copied-file remediation emits cp {quote_arg(source)} {quote_arg(ctx.root / rel / name)} (shape-doctor.py ~:1095). On Windows the shell this standard documents is PowerShell, where cp is the alias of Copy-Item, whose -Path parameter treats [, ], *, ? as wildcard syntax EVEN INSIDE a single-quoted literal. A valid root such as C:\work[old]\Atlas therefore makes the emitted line fail or copy a different item. quote_arg (#102) fixes tokenization only; this is parameter semantics.

The fix. On nt emit Copy-Item -LiteralPath {quote_arg(source, "nt")} -Destination {quote_arg(target, "nt")}; keep cp on POSIX. Same shape as scaffold_command's per-platform branch (and see #103 for threading platform through the inner quote_arg calls, so the two fixes fit together). Test: a source or target containing [old] renders with -LiteralPath on nt and plain cp on posix, asserted byte for byte from any host.

Activity

  1. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openreposhape-2 (openRepoShape-2), session 8706b0f5, 2026-09-11T13:10Z, for the whole of this issue, branch fix/doctor-copy-item-literalpath.

    The three reads Rule 1 asks for, and what they returned:

    1. Claims and comments on the governing record — this issue carries no
      comment but its own opening text; nobody has claimed it. Its two siblings
      out of the same review, shape-doctor.py: scaffold_command(…, platform) quotes for the HOST while it spells the interpreter and entry point for the REQUESTED platform — thread platform through its quote_arg calls #103 (scaffold_command's inner quote_arg calls
      and the way-in row) and shape-doctor.py: the naming row hands repository names to argparse as bare positionals — a directory named --help is read as an option in both the validator call and the emitted --explain line; put -- before the names #104 (the naming row), are being worked in
      parallel lanes in their own worktrees: this branch touches NEITHER
      scaffold_command NOR the way-in NOR the naming row, only the
      leg-shape-files remediation and a new module-level helper beside
      scaffold_command, and its tests sit next to the existing drifted-file
      tests rather than at the end of the file, so the three rebase clean.
    2. gh pr list --repo opensoft/openRepoShape --state all — no open PR on
      this repository at all.
      Everything that touches shape-doctor.py (One command answers whether a repository is compliant: openRepoShape --doctor, and the machine check becomes --preflight #96,
      The doctor reads where a file LIVES against where the policy puts it: a placement row, code-in-spec and spec-in-code, and a plan the human resolves (#99) #100, shape-doctor.py: one platform-aware quoter, on every next command, so a root or a name with a space in it is a line that runs (#101) #102) is MERGED; shape-doctor.py: one platform-aware quoter, on every next command, so a root or a name with a space in it is a line that runs (#101) #102 is the quoter this finding sits one step past.
    3. git ls-remote --heads origin | grep -iE 'copy|literal|doctor|quot' — no
      hits at all; the branch fix/doctor-copy-item-literalpath does not exist
      on the remote.

    Working in a linked worktree cut from origin/main at 32450eb; the shared
    checkout belongs to another session and is not touched. Read in full before
    authoring: quote_arg, UNQUOTED_POSIX, UNQUOTED_NT, python_command and
    scaffold_command in shape-doctor.py, the leg-shape-files check and its
    cp remediation, the drifted-file and remediation tests in
    tests/test_shape_doctor.py, PR #102's body and its Copilot round, and
    scripts/render-cli-reference.py / docs/cli.md (no --help text moves).

    The other emitted verbs, checked so the scope is a fact and not an
    assumption:
    shape-doctor.py emits exactly one shell-builtin command, this
    cp. Every other remediation is python3 …, git -C … fetch --all or
    git -C … checkout -- <path> — the same binary with the same parsing on both
    platforms, no shell verb and no PowerShell parameter semantics. (git checkout -- 'file[old].txt' over a file literally so named was run here and restores
    that file, so the git line is not the same defect; git pathspec wildcards
    would be a platform-independent question of git's own, not this one.)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions