Recursive cp overwrites files one directory too high on Linux when the source name ends in a literal backslash and dot
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは src/uu/cp/src/copydir.rs の再帰コピーで使われるサフィックスのヘルパー(122-146 行付近)にあり、すべてのプラットフォームでバックスラッシュを区切り文字として扱っています。そこから始めて、issue の再現手順をローカルビルドに対して実行してください。完了とは、Linux 上で draft\. という名前のソースが archive/draft\./notes にコピーされ、archive/notes を上書きせず、一方で Windows の区切り文字の扱いはこれまでどおりに動作することです。
索引モデルが issue の本文から書いたものです。
説明
On Linux, backslash is a literal filename character. Recursive cp treats a source basename ending in \. like the special suffix /. and overwrites files directly in the destination.
work=$(mktemp -d) && cd "$work" || exit 1
src='draft\.'
mkdir "$src" archive
printf 'incoming\n' > "$src/notes"
printf 'original\n' > archive/notes
cp -R "$src" archive
printf 'cp exit=%s\n' "$?"
cat archive/notes
test -f "archive/$src/notes" && echo present || echo missing
uutils 0.12.0, 0.13.0 and main at 85dd1ff print cp exit=0, incoming, missing. The original destination file is overwritten and the expected subdirectory is absent. GNU 9.7 and 9.12 print cp exit=0, original, present. The copied file under the source basename contains incoming.
Tested on x86_64 Linux. The same overwrite occurs with cp -a and with overlapping files in deeper subdirectories. A source named draft. works correctly on all five builds.
The suffix helper treats both slash and backslash as separators regardless of platform. The Unix check should recognize only slash. Source
- 主要言語
- Rust
- スター
- 24.4k
- フォーク
- 2.2k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 383
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
cp: -r into a missing parent prints a bare "No such file or directory (os error 2)"対応中かも @binhvq が今日担当しました。 オープンU - cp
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
nice: an empty -n value takes the next argument as the adjustment対応中かも @binhvq が今日担当しました。 オープンU - nice
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
truncate: an absolute --size with --reference is checked after the reference file対応中かも @binhvq が 1 日前に担当しました。 オープンU - truncate
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
dd: conv=sync repeats bytes from the previous block when a byte count ends mid-block対応中かも @yxshee が 1 日前に担当しました。 オープンU - dd
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
uutils/coreutils#16770 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
llm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/datafusion#27688 ·
メンテナーはふだん 1 日以内に返信
-
ai_p1 comp-sql-syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ClickHouse/ClickHouse#133888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
horizon-rust/horizon#20542 ·
メンテナーはふだん 1 日以内に返信