Repository navigation
date: escape control characters in invalid date messages like GNU - #14868
Conversation
|
GNU testsuite comparison: |
| Ok(ParsedDateTime::Extended(_)) | Err(_) => { | ||
| return Err(Box::new(DateError::InvalidDate { | ||
| date: input.clone(), | ||
| date: escape_for_error(input.as_bytes()), |
There was a problem hiding this comment.
please add a test in tests/by-util/test_date.rs for tab/CR/ESC with -d and with a -f file
| Ok(ParsedDateTime::Extended(date)) if allow_extended => Ok(ParsedDateTime::Extended(date)), | ||
| Ok(ParsedDateTime::Extended(_)) => Err(( | ||
| input_str.into(), | ||
| escape_for_error(input_str.as_bytes()), |
There was a problem hiding this comment.
the non-UTF-8 locale branch (quote + non-ASCII octal) isn't tested either, could you add one with LC_ALL=C?
ae421c7 to
8d964ca
Compare
Merging this PR will improve performance by ×2.3
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | factor_three_39_bit_primes |
800.7 ms | 345.6 ms | ×2.3 |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing anasbekheit:date-escape-invalid-date (1f969e4) with main (2fb77e8)
Footnotes
-
70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Are there any concerns blocking the merge of this PR? |
|
Sorry it needs to be rebased |
8d964ca to
d45055e
Compare
|
@sylvestre the branch is rebased. |
d45055e to
1f969e4
Compare
|
@sylvestre, the branch is rebased again, are there any outstanding comments? |
|
Thanks for your PR |
The "invalid date" message printed the input as-is, so tabs, CR, backspace
and ESC in a
-dargument or a-fline went to the terminal raw, and a filecould inject escape sequences. GNU escapes them.