Hello,

Mikhail Karpov, le mar. 08 sept. 2026 12:00:06 +0700, a ecrit:
> If you try to rename a file with the -n flag while keeping the same name, mv
> reports that no replacement occurred in GNU/Linux, while mv reports nothing
> in GNU/Hurd:
> 
> user@user:~$ > file
> user@user:~$ stat file
>   File: file
>   Size: 0             Blocks: 0          IO Block: 4096   regular empty file
> Device: 259,2    Inode: 10131664    Links: 1
> Access: (0664/-rw-rw-r--)  Uid: ( 1000/    user)   Gid: ( 1000/ user)
> Access: 2026-09-08 10:58:30.443730136 +0700
> Modify: 2026-09-08 10:58:30.443730136 +0700
> Change: 2026-09-08 10:58:30.443730136 +0700
>  Birth: 2026-09-08 10:58:30.443730136 +0700
> user@user:~$
> user@user:~$ mv -n file file
> mv: not replacing 'file'

I am not getting this error on linux:

€ mv -n blip blip
€

(and stat doesn't change either)

> Since the file's stat doesn't change, I assume mv isn't performing any
> manipulations on the file and simply doesn't report that no replacement
> occurred.  As far as I can tell, this is because the copy_internal function
> from coreutils/src/copy.c handles this error differently.
> 
> Is this behavior desirable?

That would probably have to be discussed with coreutils people :)

Samuel

Reply via email to