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

Aperta Adatta ai principianti
#17,003 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend, cli

Direzione di ricerca

Inizia in src/uu/mv/src/mv.rs intorno alle righe 827–838, dove il controllo del timestamp restituisce il controllo prima della rinomina, e confrontane il comportamento con la regola del manuale di GNU mv per le directory di origine. Aggiungi un test di regressione per riprodurre il problema usando una directory di destinazione vuota con un timestamp uguale o più recente; verifica che mv -u sposti i file di origine e termini correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
24.5k
Fork
2.2k
Merge medio
2g 9h
PR unite (30g)
325

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di uutils/coreutils

Tutte le issue di uutils/coreutils

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.