mv -u silently skips an entire directory when the destination directory has an equal or newer timestamp

オープン 初心者向け
#17,003 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend, cli

調査の方向性

src/uu/mv/src/mv.rs の827~838行あたりから始めます。ここではタイムスタンプのチェックが名前変更の前に処理を返すため、その動作を GNU mv のマニュアルにあるディレクトリをソースとする場合の規則と比較します。タイムスタンプが同じか新しい空の宛先ディレクトリを使って再現する回帰テストを追加し、mv -u がソースファイルを移動して正常終了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

When the destination is an existing empty directory with an equal or newer modification time, mv -u exits 0 but leaves the entire source directory in place. A script that pre-creates a staging directory can continue to packaging with all the files from the move missing.

Reproduction

Run once per implementation with the mv under test on PATH.

cd "$(mktemp -d)" || exit 1
export LC_ALL=C
mkdir -p release stage/release
printf 'package\n' > release/manifest
touch -d @1000000000 release
touch -d @1000000001 stage/release

mv -u release stage/
printf 'mv exit: %s\n' "$?"
find . -name manifest -print

Expected (GNU Coreutils 9.7 and 9.12)

mv exit: 0
./stage/release/manifest

Actual (uutils 0.13.0 and main)

mv exit: 0
./release/manifest

Neither implementation prints a diagnostic. With uutils, stage/release remains empty. The GNU mv manual limits the timestamp skip to non-directory sources.

Source

In mv.rs, lines 827–838, (!from_is_dir || to_metadata.is_dir()) is true when both entries are directories. If the source mtime is less than or equal to the destination mtime, the function returns Ok(()) before attempting the rename.

Tested on Debian 13, x86-64 Linux 6.18.57, with uutils 0.13.0 (07b76df), upstream main (2a072db), and GNU Coreutils 9.7 and 9.12. I found no matching issue or PR. The related PR #15912 addressed dangling destination symlinks.

主要言語
Rust
スター
24.5k
フォーク
2.2k
平均マージ
2日 9時間
マージ済み PR(30日)
325

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。