uutils / uutils/coreutils

`mv` shouldn't delete directory before it's moved/copied entirely

Open
#7,933 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - mv
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

This only applies when mv-ing directories across different filesystems.

According to this StackOverflow post, in particular user263131's command, if I run (coreutils) mv /mnt/fs1/foo /mnt/fs2/ and I interrupt before the command is completed, the contents of /mnt/fs1/foo should stay unchanged. However, this is not behavior of uutils mv. To repro,

mkdir test
dd if=/dev/zero of=test/a bs=1M count=100
dd if=/dev/zero of=test/b bs=1M count=100
dd if=/dev/zero of=test/c bs=1M count=100
dd if=/dev/zero of=test/d bs=1M count=100
mv -g test /mnt/fs1/

Watch the progress bar and Ctrl+C after one file is moved. You will see that test only contains 3 files now. However, the behavior of mv is that all 4 files remain. You can verify this by running (coreutils) mv -v test /mnt/fs1 and Ctrl+C after one file is copied. All files in test are preserved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the interrupted cross-filesystem move with the commands in the issue, then compare uutils mv with coreutils behavior. Trace the mv command's directory-copy and cleanup path; done means interrupting after a partial copy leaves every source file in the original directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.