report and trees escape their path columns: backslash, tab, newline and carriage return are written as \\, \t, \n and \r. Every other byte is written unchanged, including bytes that are not valid UTF-8. Both commands use one function, escapePath in report.go.
Grouping and sorting still use the stored path. The test pair is chosen so that escaping would flip its order, because a raw tab sorts before A and \t sorts after it.
In trees, the root directory's node now has the path /, and its children are /srv, not //srv.
README.md states the rule under "Report output format", and "Trees output format" points to it.
Things to know
Warnings are escaped in warnf, the whole message rather than just the path argument. The error text repeats the path (for example lstat /x: ...), so escaping only the argument would still split the line.
escapePath skips building a strings.Replacer when none of the four bytes is present. The lint config rules out a package-level replacer, and building one per row would allocate on every row.
#13 also edits warnf, and #30 edits the same write loops. Whichever lands second rebases.
Disclosures
Rule suppressed: paralleltest on TestWarnfEscapes, which swaps the process-wide os.Stderr (the same reason as the existing TestRunHelpAndVersionSucceed).
Judgement call: fatal error messages (sfdupes: ..., exit 1) are not escaped, only the warnings, which is the issue's scope.
Model: opus-5-5
Implements https://git.eeqj.de/sneak/sfdupes/issues/7.
**What changed**
- `report` and `trees` escape their path columns: backslash, tab, newline and carriage return are written as `\\`, `\t`, `\n` and `\r`. Every other byte is written unchanged, including bytes that are not valid UTF-8. Both commands use one function, `escapePath` in `report.go`.
- Grouping and sorting still use the stored path. The test pair is chosen so that escaping would flip its order, because a raw tab sorts before `A` and `\t` sorts after it.
- In `trees`, the root directory's node now has the path `/`, and its children are `/srv`, not `//srv`.
- `README.md` states the rule under "Report output format", and "Trees output format" points to it.
**Things to know**
- Warnings are escaped in `warnf`, the whole message rather than just the path argument. The error text repeats the path (for example `lstat /x: ...`), so escaping only the argument would still split the line.
- `escapePath` skips building a `strings.Replacer` when none of the four bytes is present. The lint config rules out a package-level replacer, and building one per row would allocate on every row.
- https://git.eeqj.de/sneak/sfdupes/issues/13 also edits `warnf`, and https://git.eeqj.de/sneak/sfdupes/issues/30 edits the same write loops. Whichever lands second rebases.
**Disclosures**
- Rule suppressed: `paralleltest` on `TestWarnfEscapes`, which swaps the process-wide `os.Stderr` (the same reason as the existing `TestRunHelpAndVersionSucceed`).
- Judgement call: fatal error messages (`sfdupes: ...`, exit 1) are not escaped, only the warnings, which is the issue's scope.
Model: opus-5-5
A path holding a tab or newline split a row of the report or trees
output. The path columns of both now write a backslash, tab, newline
and carriage return as \\, \t, \n and \r; every other byte is written
unchanged. Grouping and sorting still use the stored path. Warnings
on stderr are escaped the same way in warnf, so each stays one line.
In trees, the root directory's node now has the path "/" instead of
an empty string, and its children's paths start with a single slash.
README states the rule under "Report output format".
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements #7.
What changed
reportandtreesescape their path columns: backslash, tab, newline and carriage return are written as\\,\t,\nand\r. Every other byte is written unchanged, including bytes that are not valid UTF-8. Both commands use one function,escapePathinreport.go.Aand\tsorts after it.trees, the root directory's node now has the path/, and its children are/srv, not//srv.README.mdstates the rule under "Report output format", and "Trees output format" points to it.Things to know
warnf, the whole message rather than just the path argument. The error text repeats the path (for examplelstat /x: ...), so escaping only the argument would still split the line.escapePathskips building astrings.Replacerwhen none of the four bytes is present. The lint config rules out a package-level replacer, and building one per row would allocate on every row.warnf, and #30 edits the same write loops. Whichever lands second rebases.Disclosures
paralleltestonTestWarnfEscapes, which swaps the process-wideos.Stderr(the same reason as the existingTestRunHelpAndVersionSucceed).sfdupes: ..., exit 1) are not escaped, only the warnings, which is the issue's scope.Model: opus-5-5
Review passed.
Model: opus-5-5