[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Failed to preserve ownership" exit(1) bug in mv?

From: Jim Minter
Subject: Re: "Failed to preserve ownership" exit(1) bug in mv?
Date: Sat, 3 Jun 2017 11:19:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/06/17 05:56, Pádraig Brady wrote:
On 02/06/17 09:07, Jim Minter wrote:

A behaviour that surprised me with mv, moving files to an NFS-mounted
filesystem with all_squash set (in a Vagrant box running Fedora 25,
coreutils 8.25).

(/vagrant is NFS-mounted as described in the example below).

==== 8< ====
[vagrant@default ~]$ sudo -i
[root@default ~]# ln -s thing symlink
[root@default /]# mv symlink /vagrant
mv: failed to preserve ownership for /vagrant/symlink: Operation not
[root@default /]# echo $?
[root@default /]# ls . /vagrant

==== 8< ====

The surprise to me is that mv exits early in this case (after copying
the symlink across volumes, before removing the source symlink).

Doing the same operation as root but with a regular file, I get the same
warning message, but the move completes as expected, and mv returns exit
status 0.  I had expected the same behaviour when moving a symlink.

(As non-root, mv works as expected both for a file and for a symlink -
object moved, chown syscall fails, no warning message).

The knock-on effect I've seen which is particularly problematic, is that
this issue causes mv to fail when moving an entire directory tree as
root to an NFS-mounted filesystem, if that directory tree contains a
symlink anywhere within it.  Can the exit(1) in this case be considered
a bug?

That indeed looks like a bug that has been present since the initial 
The attached should fix it up.


Hi Pádraig,

Many thanks for the quick reply. I've checked and confirm that your patch resolves the problem for me.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]