Skip to content

mv: don't skip a directory source with -u - #17011

Open
seragAhmed wants to merge 1 commit into
uutils:mainfrom
seragAhmed:fix/17003-mv-update-directory
Open

seragAhmed wants to merge 1 commit into
uutils:mainfrom
seragAhmed:fix/17003-mv-update-directory

Conversation

@seragAhmed

Copy link
Copy Markdown
Contributor

mv -u dir dest/ returned early when dest/dir was an existing directory at least as new as the source, so nothing was moved and nothing was reported. The GNU manual limits the -u timestamp skip to non-directory sources, and GNU mv does move the directory here.

The check now only skips when the source isn't a directory; a directory always goes on to the rename, which still fails if the destination directory isn't empty. Added a Unix test that sets the source directory's mtime to the epoch and moves it onto a fresh empty directory.

Fixes #17003

--update only skips a non-directory whose destination is not older. A
directory onto an existing empty directory with a newer or equal timestamp
was skipped silently, leaving everything in the source.

This branch has not been deployed

No deployments
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.

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

1 participant