mv: moving a special file across filesystems deletes the destination on failure
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- cli, operating-systems
Research direction
Start by tracing mv's cross-filesystem fallback for special files and reproduce the failure with a socket on one filesystem and a destination on another. Verify that a failed move preserves the existing destination, and add or run coverage for the reported repro and error behavior if the relevant test location is identified.
Written by the indexing model from the issue text.
Description
Reported by @HackingRepo via security advisory GHSA-xw28-j282-p74c. We don't consider this a security issue, so we're tracking it as a regular bug.
Description
When mv falls back to the copy path (cross-filesystem / EXDEV) for a special file (e.g. a socket) and the operation fails, the existing destination is removed entirely, causing data loss.
Repro (socket on tmpfs, dest on a different filesystem to force the copy path)
$ echo important > a
$ mv /path/on/tmpfs/sock a
mv: Permission denied (os error 13)
$ cat a
cat: a: No such file or directory # 'a' was deleted
GNU leaves a in place (recreated as a socket) rather than deleting it.
Expected: on a failed cross-fs move of a special file, the existing destination must not be destroyed.
Actual: destination is removed, original contents lost.
(Also: the error carries (os error 13) and lacks the 'src' to 'dest' context GNU prints.)
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/coreutils
-
U - ls
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
U - ls
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
U - tr
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
U - date
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
U - date
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in uutils/coreutils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100