Skip to content

uucore: quoting_style: escape U+2028 and U+2029 like control characters - #15853

Open
vibhuthespeedst wants to merge 2 commits into
uutils:mainfrom
vibhuthespeedst:quoting-escape-line-separators
Open

vibhuthespeedst wants to merge 2 commits into
uutils:mainfrom
vibhuthespeedst:quoting-escape-line-separators

Conversation

@vibhuthespeedst

Copy link
Copy Markdown

Fixes #15745

ls -b, -Q, -q and --quoting-style=shell-escape printed U+2028 and U+2029 raw, because only char::is_control() decided what to escape. They are now treated like control characters, which matches GNU (x\342\200\250.. for -b, x?.. for -q).

EscapeOctal only handled characters up to 2 bytes, since controls never need more. It now handles any UTF-8 length; output for 1 and 2 byte characters is unchanged.

Added a test for both characters across the quoting styles.

@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.47%

1 warning, 1 note

⚠️ 119 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

❌ 1 regressed benchmark
✅ 400 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation sort_reverse_utf8_locale 79.1 ms 82 ms -3.47%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing vibhuthespeedst:quoting-escape-line-separators (f9450d0) with main (1d6ca65)2

Open in CodSpeed

Footnotes

  1. 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. ↩

  2. No successful run was found on main (0776385) during the generation of this report, so 1d6ca65 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

ls -b, -Q, -q and shell-escape printed the line and paragraph
separators raw, unlike GNU. EscapeOctal now handles characters of any
UTF-8 length, since these two take three bytes.

Fixes uutils#15745
@vibhuthespeedst
vibhuthespeedst force-pushed the quoting-escape-line-separators branch from f9450d0 to 21daa55 Compare October 26, 2026 19:50

/// Bytes we need to present as escaped octal, in the form of `\nnn` per byte.
/// Only supports characters up to 2 bytes long in UTF-8.
/// Escapes each UTF-8 byte of a character as `\ooo`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line repeats the one above, could be removed

}

#[test]
fn test_line_and_paragraph_separators() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please also add a test in tests/by-util/test_ls.rs with -b and -q? thanks

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure

Also drop a doc comment line that repeated the one above it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls: -b and -Q do not escape U+2028 and U+2029 line separators, unlike GNU

2 participants