Repository navigation
uucore(mode): quote the offending character in invalid operator errors - #15409
henrimarconni wants to merge 1 commit into
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
|
the CI has been failing on this one for a while, could you please have a look? otherwise, i will close it, thanks |
30f906e to
ecceb47
Compare
|
Sorry for the late reply, I'll fix the failing checks and update the PR shortly. |
ecceb47 to
ad669aa
Compare
|
GNU testsuite comparison: |
| ucmd.args(&["g+rw?x", "probe"]) | ||
| .fails_with_code(1) | ||
| .stderr_only("chmod: invalid operator (expected +, -, or =, but found ?)\n"); | ||
| .stderr_only("chmod: invalid operator (expected +, -, or =, but found '?')\n"); |
There was a problem hiding this comment.
test_chmod_invalid_mode_checked_before_any_file (line 1408) still expects the old message, please update it too
|
|
||
| assert!( | ||
| stderr.contains("invalid operator (expected +, -, or =, but found \\001)"), | ||
| stderr.contains("invalid operator (expected +, -, or =, but found '\\001)'"), |
There was a problem hiding this comment.
the quote is misplaced, should be '\\001'), that's why CI is red
| fn test_invalid_mode_operator_is_quoted() { | ||
| let (_, mut ucmd) = at_and_ucmd!(); | ||
| ucmd.args(&["-m", "\u{AF}", "c"]) | ||
| .fails() |
There was a problem hiding this comment.
could you please use fails_with_code(1) and stderr_only like the other tests?
|
clippy is sad :), and a bunch of jobs are failing |
ad669aa to
071c255
Compare
071c255 to
8d1460e
Compare
Fixes #15350
mkdir -m $'\xC2\xAF' ccurrently prints the offending character bare:With odd or non-ASCII characters it's hard to tell what you're looking at, so I wrapped it in single quotes:
The message template lives in uucore, so
chmodgets the same change. I updated the two existing tests that checked the old text (chmod and mkdir) and added a mkdir test for the non-ASCII case from the issue.One thing to flag: GNU says
invalid mode '¯'instead of our "invalid operator (...)" wording. I only fixed the quoting here and left the wording alone, since it's tied to the caret diagnostic.(Side note: the issue title says
mv, but the repro ismkdir.)Tested with
cargo fmt,cargo clippy -p uucore -p uu_mkdir, andcargo test -p uucore -p uu_mkdir -p uu_chmod.