You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mv: moving a special file across filesystems deletes the destination on failure #13145
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.)
Activity
fix(mv): don't destroy the destination when a cross-device move fails
mv: trim unrelated churn from the special-file fix
mv: trim unrelated churn from the special-file fix
fix(mv): don't destroy the destination when a cross-device move fails
mv: trim unrelated churn from the special-file fix
fix(mv): don't destroy the destination when a cross-device move fails
mv: trim unrelated churn from the special-file fix
fix(mv): don't destroy the destination when a cross-device move fails
mv: trim unrelated churn from the special-file fix
mv: recreate special files when moving across devices
mv: recreate special files when moving across devices
mv: recreate special files when moving across devices
mv: recreate special files when moving across devices