xargs: -d '\0' is rejected, and octal escapes need a leading 0
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start with parse_delimiter in src/xargs/mod.rs and the test_delimiter_parsing test mentioned in the issue. Compare its escape parsing with the GNU examples in the body, then run the delimiter parsing tests. Done when the listed accepted and rejected escapes behave as described and the existing test reflects the intended \0 behavior.
Written by the indexing model from the issue text.
Description
$ printf 'a\0b' | xargs -d '\0' echo
Error: error: invalid value '\0' for '--delimiter <delimiter>': Invalid octal sequence: cannot parse integer from empty string
$ printf 'a\0b' | /usr/bin/xargs -d '\0' echo # GNU findutils 4.10.0
a b
$ printf 'a:b' | xargs -d '\72' echo
Error: error: invalid value '\72' for '--delimiter <delimiter>': Invalid escape sequence: \72
GNU's manual says -d takes "an octal or hexadecimal escape code ... understood as for the printf command", and GNU xargs accepts \0, \72, \072, \101 and \0101. It rejects \400, \8 and \09.
In parse_delimiter (src/xargs/mod.rs:914), any escape that starts with 0 goes to the octal branch with the 0 removed, so \0 parses an empty string; the "0" => Ok(b'\0') arm below it never runs. Octal without a leading 0 isn't handled at all.
test_delimiter_parsing asserts parse_delimiter("\\0").is_err(), so matching GNU means changing that line. I have a fix that parses \ followed by octal digits as one octal value, with tests for the cases above; happy to open a PR if you want GNU's behaviour here.
uutils findutils main 505421d.
- Dominant language
- Rust
- Stars
- 653
- Forks
- 115
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/findutils
-
find: -printf %h drops a doubled slashPossibly taken @qodelicious claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
find: -printf %TT and %TX drop the fraction of a secondPossibly taken @qodelicious claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
uutils/findutils#692 · 1 comment ·
Maintainers usually reply within 1 day
-
find: -fprint /dev/stdout truncates a redirected stdoutPossibly taken @qodelicious claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 1 day
All issues in uutils/findutils
Similar issues
-
rust_analyzer flycheck: no CLI way to enable clippy from `check.overrideCommand`Possibly taken @TrapsterDK claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bazelbuild/rules_rust#4392 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
🐞 bug 🧩 bevy_gantz_egui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nannou-org/gantz#500 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
metasequoiaime/msime#10989 ·
Maintainers usually reply within 1 day