coreutils
[Top][All Lists]
Advanced

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

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


From: Pádraig Brady
Subject: Re: "Failed to preserve ownership" exit(1) bug in mv?
Date: Fri, 2 Jun 2017 21:56:59 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 02/06/17 09:07, Jim Minter wrote:
> Hello,
> 
> 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 
> permitted
> [root@default /]# echo $?
> 1
> [root@default /]# ls . /vagrant
> .:
> symlink
> 
> /vagrant:
> symlink
> ==== 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 
implementation!
The attached should fix it up.

thanks!
Pádraig

Attachment: chown-symlink-warn-only.patch
Description: Text Data


reply via email to

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