Skip to content

[P0-class] mkdir/touch/cp/rm/rmdir re-expand already-expanded argv (siblings of #511) #555

Closed

Description

@caomengxuan666

Sibling class of #511 (P0, fixed by #552): five more external file builtins re-expand already-expanded argv

#552's investigation found that external_cat's operand loop was not unique — the same file
(src/executor/external_file_builtins.rs) contains five sibling wrappers that re-run
expand_word over argv which the simple-command executor has already expanded:

Same silent-corruption class as #511: a single-quoted operand reaches the builtin with the
quotes stripped but a live-looking $, and the second expansion rescan opens/creates/
removes the wrong path. The fix pattern is proven by #552 (use argv as-is; pathname
expansion happens once at dispatch) and by sed's earlier #177 fix in the same file.

Acceptance

  • One regression test per builtin (quoted $VAR operand must stay literal; \$ escaped;
    unset variable stays literal error text — mirroring tests/issue511_cat_quoted_operand_regressions.rs)
  • The whole family covered by a shared test helper so the next wrapper added to this file
    cannot reintroduce the pattern

Activity

  1. added a commit that references this issue on Oct 12, 2026
  2. added
    bug
    P0-critical
    area:glob
    on Oct 17, 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

    P0-criticalarea:globbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions