dircolors: '=' is not escaped and '^'/'\\' do not toggle the backslash state, unlike GNU
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #16711 @saromanov による — マージされずにクローズ
評価
調査の方向性
src/uu/dircolors/src/dircolors.rs の escape() から始め、Issue に記載された GNU の need_backslash の規則と動作を比較してください。ls にある既存の parse_funky_string の処理を確認し、=, ^, バックスラッシュ、--print-ls-colors に焦点を当てたテストを追加または更新してください。対象の出力が GNU の例と一致し、表示専用の出力で文字がエスケープされない状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
escape() in src/uu/dircolors/src/dircolors.rs only escapes ' and :, and treats : as escaped unless the previous character is \. GNU coreutils uses a different quoting algorithm with a need_backslash state: \ and ^ toggle the state, and both : and = are escaped when the state says so. This produces different LS_COLORS output for several inputs.
Consequences:
=is never escaped. ThelsLS_COLORSparser treats\=as a literal=inside a glob item, so patterns containing=are mis-parsed when they are not escaped.^starts an escape sequence (^Xcontrol notation) in thelsparser, so it must toggle the backslash state; currently uutils escapes the:after^, GNU does not.- Because
\should toggle rather than disable escaping positionally,\\:must still escape the:. --print-ls-colorsoutput escapes:, although GNU does not escape anything in that (display-only) mode.
Note: the missing csh escaping of ! is already tracked in #16496, this issue is only about the four points above.
Reproduction
Compared against GNU coreutils 9.11 (TERM=xterm, both reading a config from stdin via -):
$ printf 'exec x=y 01;33\n' | dircolors -b -
GNU: LS_COLORS='ex=x\=y 01;33:';
uutils: LS_COLORS='ex=x=y 01;33:';
$ printf 'exec ^:x 01;33\n' | dircolors -b -
GNU: LS_COLORS='ex=^:x 01;33:';
uutils: LS_COLORS='ex=^\:x 01;33:';
$ printf 'exec x\\:y 01;33\n' | dircolors -b -
GNU: LS_COLORS='ex=x\\\:y 01;33:';
uutils: LS_COLORS='ex=x\\:y 01;33:';
Versions
- uutils coreutils: master, commit
a663b441b9b350ec54732974ae0cb7ae22e8f5b2(also reproduces with the 0.10.0 binary shipped by the distro) - GNU coreutils: 9.11
- Platform: Linux x86_64
The ls parser on both sides already understands \= / \: escapes (parse_funky_string), so fixing escape() does not break ls.
- 主要言語
- Rust
- スター
- 24.4k
- フォーク
- 2.2k
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 402
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
split -n leaves bytes from a previous run in chunks that should be empty対応中かも @costajohnt が 2 日前に担当しました。 オープンU - split
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
U - shred
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
chown -v: `+ID` spec echoed verbatim on a broken symlink対応中かも @sunsss123soldier が 7 日前に担当しました。 オープンgood first issue oss-scanner U - chown
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
dircolors: --csh doesn't escape `!`再び着手できるかも @majidninja が 7 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンgood first issue oss-scanner U - dircolors
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
uutils/coreutils#16496 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
go good first issue test
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信
-
bug triaged tui ux wontfix
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
bevyengine/bevy#26642 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信