bug#81377: mv -Tn suceeds if target directory exists, no error printed
Florian Weimer via GNU coreutils Bug Reports <[email protected]> Wed, 08 Jul 2026 14:51:04 +0200
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
* Florian Weimer via: > Based on the documentation, I would have expected an error in this case. > > mkdir a a/1 b b/2 > mv -Tn a b > > Exit status is zero. The only relevant system call in the strace output > is this one: > > renameat2(AT_FDCWD, "a", AT_FDCWD, "b", RENAME_NOREPLACE) =3D -1 EEXIST (= File exists) > > Seen with: coreutils-9.7-9.fc43.x86_64 I see that there is a hint in the -n description that the exit status may not be what users expects. But it means that this claim in the manual is slightly misleading: | However, if =E2=80=98mv -T /tmp/source /tmp/dest=E2=80=99 succeeds, there= is no | question that =E2=80=98/tmp/source=E2=80=99 was renamed to =E2=80=98/tmp/= dest=E2=80=99. Florian