mv
: -n
(--no-clobber
) is racy, unlike GNU mv
#7791
Labels
mv
: -n
(--no-clobber
) is racy, unlike GNU mv
#7791
GNU
mv
makes its best attempt to userenameat2
with theRENAME_NOREPLACE
flag, falling back via gnulib to theaccessat
+renameat
(or via glibc toaccess
+rename
on even older kernels) if that isn't possible. uutilsmv
does not userenameat2
, performing a racy check which is essentially equivalent to theaccess
+rename
construction. This introduces a low but non-zero risk of data loss when-n
is relied upon. (For reference, BusyBoxmv
has the same deficiency, and, like uutils, does not bother withrenameat
andaccessat
, only making use ofaccess
andrename
instead.)The text was updated successfully, but these errors were encountered: