Skip to content

fix(ls): merge adjacent $'...' segments in shell-escape quoting (Fixes #1890) - #1893

Merged
caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/1890-ls-shell-escape-segments
Nov 27, 2026
Merged

caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/1890-ls-shell-escape-segments

Conversation

@dingyi580

Copy link
Copy Markdown

Summary

  • Port gnulib quotearg.c (quotearg_buffer_restyled, pending_shell_escape_end) state tracking to ls::shell_escape_quote_display_name_l:
    • Adjacent non-printable characters share one $'...' segment (''$'\344\270\255\346\226\207' in LC_ALL=C instead of ''$'\344\270\255'''$'\346\226\207''').
    • Trailing $'...' segments close directly without emitting a redundant trailing ''.
    • Quote empty strings "" as '', escape \0 as \0, and escape 0x7f (DEL) as \177 instead of treating \u{7f} as printable.
  • No user-visible natural-language I18N catalog keys (tr!) are touched.

Fixes #1890

What was removed

  • Removed stateless per-character '$'...' open/close wrapping and the erroneous || c == '\u{7f}' printable exemption in shell_escape_quote_display_name_l, and updated the stale comment/expectation in explicit_c_locale_still_escapes_cjk_in_shell_escape.

Verification

  • rustfmt --check --edition 2021 rust2/crates/winux-cmds/src/ls.rs: passed
  • cargo check --workspace --tests --target x86_64-pc-windows-msvc & aarch64-pc-windows-msvc: passed
  • Windows cargo test & differential gate execution: owed to PR CI

@caomengxuan666

Copy link
Copy Markdown
Member

CAPTAIN-VERIFY(X299 运行时复验):达合入门,队长合入。lib 计数对账对平:新树(base 363d7a0c + head ls.rs、blob 与 PR head 逐字对上、独立 target 真编译)全量 1092 passed / 0 failed = 基线 1091 + 新增 1 钉;新增钉 shell_escape_merges_adjacent_escapes_and_transitions_like_quotearg 与改期望的既有钉 explicit_c_locale_still_escapes_cjk_in_shell_escape 逐名 ok、零新增失败。连同上轮 oracle 八形全合(云端 GNU coreutils 9.4),本 PR 证据面全闭。

@caomengxuan666
caomengxuan666 merged commit 319a60d into unixwin:main Nov 27, 2026
32 checks passed
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.

[bug] ls shell-escape quoting segments $'...' per character in C locale (GNU merges one segment)

2 participants