Skip to content

6.3 command execution: the environment supersedes positional args and the PowerShell file tier #804

Open

Description

@David-Noble-at-work

Part of #799.

docs/architecture/6.3-command-execution.md (draft, 2026-08-19) is right about the defect and wrong
about the remedy in one respect. Its thesis stands: a command is an argv vector, and no command
string should be assembled by concatenation and handed to an interpreter's -c. Its evidence is
concrete — seventy pkg/platform call sites building strings under sudo, ParsePURL passing %3B
through as ;, and the Windows fixture where sh ate the backslashes and C:\Users\RUNNER~1\…
became C:UsersRUNNER~1….

What has changed is how values reach a body. 6.3 delivers them as positional arguments to a script
file
. #799 settles on named entries in the child's environment, which is safe in the same way
and needs no file.

What that supersedes

Measured, not assumed:

Named values File required
Positional args sh -c body sh a b works; pwsh -Command with -args is a ParserError yes, for pwsh — only -File script.ps1 a b
Environment "$unit" in sh, $env:unit in pwsh no, in either

Both forms are injection-safe: a hostile value printed literally in every case. The difference is
that positional arguments force a file on PowerShell and the environment does not.

So these sections lose their reason to exist:

  • §3.2 Where the file lives — no file
  • §3.3 PowerShell has its own tier 2 — the same body shape works in both dialects
  • §3.4 The record is the script, not the path — no script to record
  • §6.4 Elevation — no file for an elevated identity to need read access to

And §4's surface changes shape:

# 6.3 as written
plan.shell.script(body = "...", args = [name, since])

# settled in #799
shell.run_command(body = 'journalctl -u "$unit" --since "$since" | tail -20',
                  args = {"unit": name, "since": since})

A map rather than a list, "$unit" rather than "$1", and run_command rather than script —
keeping the two-verb grid (run waits, exec replaces, _command means a shell parses this)
instead of introducing a third verb that does not say whether it waits.

What survives unchanged

  • The thesis, and every word of §1 on what the current shape costs
  • Tier 1: a command is an argv vector — that is shell.run(argv), The shell provider cannot run a process directly: argv execution is absent #801
  • §5's settlements: quoting helpers dissolve rather than being answered, pipes belong in a body,
    the Windows escaping failure becomes impossible
  • §6.2 (environment and working directory) and §6.3 (stdin) remain open and are sharpened, since
    a provider that already constructs the child's environment for parameters must say what else is in
    it
  • §6.5 (interpreter availability) is unaffected

What this issue does not settle

§6.1 — does command= survive? Still open, and now load-bearing: if the escaping form is
retired, the named-body form stops being sugar and becomes the only shape; if it survives, the sugar
argument in #799 applies. That decision belongs to the epic, not to this documentation update.

The residue the spec should record

Three duties are structural — an author cannot get them wrong: values never enter program text,
set -u makes a misspelled name fail loudly, and a constructed environment makes the resolvable set
knowable. Two are the author's, and a lint rule over a literal body is what turns them into errors:

  • Unquoted expansion splits and globs. $unit holding two words becomes two arguments;
    holding *.txt it becomes a file list. A correctness bug rather than injection, and set -u does
    not catch it.
  • eval re-opens what expansion closed. Nothing at the provider boundary can prevent an author
    choosing that.

Plan and design documents

Kind Document
Plan not yet — the plan arrives when the branch does
Design 6.3-command-execution.md — the document this issue amends

Activity

  1. added
    documentation
    and removed
    documentation
    on Sep 4, 2026
  2. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rule it breaks:

    • no-evidence: no Evidence of completion section
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions