shell(mkdir, touch): report operands longer than the path buffers instead of aborting - #38379
Merged
Jarred-Sumner merged 7 commits intoAug 18, 2026
Merged
Claude / Claude Code Review
completed
Aug 14, 2026 in 18m 11s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/runtime/shell/builtin/mkdir.rs:315-322 |
mkdir absolute operand not normalized before ENAMETOOLONG check |
Annotations
Check warning on line 322 in src/runtime/shell/builtin/mkdir.rs
claude / Claude Code Review
mkdir absolute operand not normalized before ENAMETOOLONG check
The absolute-operand branch NUL-terminates the raw bytes via `ZStr::from_buf` without normalizing, so the new `filepath.len() >= MAX_PATH_BYTES` check is applied to the operand's as-written length — an absolute path like `"/tmp" + "/.".repeat(3000) + "/foo"` fails with ENAMETOOLONG instead of creating `/tmp/foo`, unlike the relative branch and unlike `touch.rs` in this same diff (which routes both branches through `join_z_spill`). Not a regression — pre-PR this failed with ENOENT, and coreutils
Loading