Email or username:

Password:

Forgot your password?
Top-level
lj·rk

@mattdm @mcc Unfortunately `-n` doesn't seem to be race-free though :/

unix.stackexchange.com/questio

With that in mind (if still true), I don't see any worth in a `-n` flag (invoking the "it's not UNIX" meme here :D). Then again, while there are many very bad options added by the GNU project if you ask me (GNU/tar's --checkpoint-action flag springs to mind), but this'd be a really useful flag in principle.

6 comments
Matthew Miller

@ljrk @mcc

Haven't tested, but I believe that's been fixed sometime after 2015. From the release notes for 8.30 (2018):

``` 'mv -n A B' no longer suffers from a race condition that can
overwrite a simultaneously-created B. This bug fix requires
platform support for the renameat2 or renameatx_np syscalls, found
in recent Linux and macOS kernels. As a side effect, 'mv -n A A'
now silently does nothing if A exists.
[bug introduced with coreutils-7.1]
```

Go Up