fix(fermata): a write never takes a printed file past the gate; a flag's value rule leaves file arguments; every spelling of a write and of a shell's line is read

-o counts as output only on a verb that neither prints nor is metadata, and on sort; what
sed -i and sort -o name stays Prints. A spaced exclude flag is skipped only where it takes
a value, so grep --ignore API .env is stopped again. >|, <>, a name with a space, sed -Ei
and --in-place, attached flag values, cp -t and a glob matching nothing yet are writes.
-ce, -cx, --command, rbash and more shells, pwsh -Com, cmd /k, bash -c --, and eval's whole
argument list are read, with all the words after the flag. git commit -F is no metadata.
Remote scp and rsync targets are no local path.
This commit is contained in:
2026-11-07 09:48:21 +01:00
parent 709f0cf1bc
commit 1e3e3648a9
3 changed files with 248 additions and 33 deletions
+2 -2
View File
@@ -148,8 +148,8 @@ fn a_writing_verb_writes_its_target() {
("mkdir -p build/x/y", &[("build/x/y", Writes)]),
("tee -a new", &[("new", Writes)]),
("dd if=.env of=new", &[(".env", Other), ("new", Writes)]),
("sed -i s/a/b/ .env", &[(".env", Writes)]),
("sed -i.bak s/a/b/ .env", &[(".env", Writes)]),
("sed -i s/a/b/ .env", &[(".env", Prints), (".env", Writes)]),
("sed -i.bak s/a/b/ .env", &[(".env", Prints), (".env", Writes)]),
("curl -o new https://example.invalid/x", &[("new", Writes)]),
("curl --output=new https://example.invalid/x", &[("new", Writes)]),
("wget -O new https://example.invalid/x", &[("new", Writes)]),