GNU bug report logs -
#20091
mv command
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20091 in the body.
You can then email your comments to 20091 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#20091
; Package
coreutils
.
(Wed, 11 Mar 2015 22:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Rogers, Charles (MAN-Corporate-CON)" <Charles.Rogers <at> DealShield.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 11 Mar 2015 22:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Is it ever possible for the mv command ( without using the -u option ) to
leave the file(s) in the source directory, while also copying to the
destination directory?
We were experiencing this under zsh and GNU/Linux 2.6.32-358.18.1.el6.x86_64.
Any comments appreciated!
thanks!
Charles Rogers
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20091
; Package
coreutils
.
(Wed, 11 Mar 2015 23:23:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 20091 <at> debbugs.gnu.org (full text, mbox):
On 11/03/15 21:02, Rogers, Charles (MAN-Corporate-CON) wrote:
> Is it ever possible for the mv command ( without using the –u option ) to
>
> leave the file(s) in the source directory, while also copying to the
>
> destination directory?
>
>
>
> We were experiencing this under zsh and GNU/Linux 2.6.32-358.18.1.el6.x86_64.
>
>
>
> Any comments appreciated!
this is mv --version 8.4 right?
How reproducible is this?
Could you send an strace from this smallest reproducer?
thanks,
Pádraig.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20091
; Package
coreutils
.
(Thu, 12 Mar 2015 17:46:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 20091 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady wrote:
> Charles Rogers wrote:
> > Is it ever possible for the mv command ( without using the –u
> > option ) to leave the file(s) in the source directory, while also
> > copying to the destination directory?
> >...
> > Any comments appreciated!
Your description implies that your destination is on a different file
system from your source. Is this one one source directory or multiple
source directories being copied at one time?
In order for mv to decide it needs to copy a file it would need to
detect that the destination directory is on a different file system
from the source directory. If so then mv will copy the file to the
destination location and remove the file from the source location.
The mv documentation describes this in some detail.
‘mv’ can move any type of file from one file system to another.
Prior to version ‘4.0’ of the fileutils, ‘mv’ could move only
regular files between file systems. For example, now ‘mv’ can
move an entire directory hierarchy including special device files
from one partition to another. It first uses some of the same
code that’s used by ‘cp -a’ to copy the requested directories and
files, then (assuming the copy succeeded) it removes the
originals. If the copy fails, then the part that was copied to
the destination partition is removed. If you were to copy three
directories from one partition to another and the copy of the
first directory succeeded, but the second didn’t, the first would
be left on the destination partition and the second and third
would be left on the original partition.
Copying files across file systems and removing them from the source is
a non-atomic operation. There is always the possibility that the
process will be stopped (possibly by being killed or other
possibilities) after it has copied a file to the destination but
before it has removed the file from the source location. It is not
possible to perform an atomic move across different file systems. Any
of those possibilities should result in mv exiting non-zero and
returning an error status to the caller. Most possibilities (not
SIGKILL which cannot be trapped) will result in mv printing an error
message to stderr. Generally if mv has an error there should be an
error message and a non-zero exit status returned to the caller.
Bob
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20091
; Package
coreutils
.
(Thu, 12 Mar 2015 22:11:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 20091 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank you all so much for the explanation. It is as you describe.
1. We had insufficient permissions on the source directory
2. The destination directory was indeed on a different file system
So, our question is answered, and again thanks.
Charles Rogers ( on behalf of Renata Karciauskaite )
-----Original Message-----
From: Bob Proulx [mailto:bob <at> proulx.com]
Sent: Thursday, March 12, 2015 1:46 PM
To: Rogers, Charles (MAN-Corporate-CON); 20091 <at> debbugs.gnu.org
Subject: Re: bug#20091: mv command
Pádraig Brady wrote:
> Charles Rogers wrote:
> > Is it ever possible for the mv command ( without using the –u
> >option ) to leave the file(s) in the source directory, while also
> >copying to the destination directory?
> >...
> > Any comments appreciated!
Your description implies that your destination is on a different file system from your source. Is this one one source directory or multiple source directories being copied at one time?
In order for mv to decide it needs to copy a file it would need to detect that the destination directory is on a different file system from the source directory. If so then mv will copy the file to the destination location and remove the file from the source location.
The mv documentation describes this in some detail.
‘mv’ can move any type of file from one file system to another.
Prior to version ‘4.0’ of the fileutils, ‘mv’ could move only
regular files between file systems. For example, now ‘mv’ can
move an entire directory hierarchy including special device files
from one partition to another. It first uses some of the same
code that’s used by ‘cp -a’ to copy the requested directories and
files, then (assuming the copy succeeded) it removes the
originals. If the copy fails, then the part that was copied to
the destination partition is removed. If you were to copy three
directories from one partition to another and the copy of the
first directory succeeded, but the second didn’t, the first would
be left on the destination partition and the second and third
would be left on the original partition.
Copying files across file systems and removing them from the source is a non-atomic operation. There is always the possibility that the process will be stopped (possibly by being killed or other
possibilities) after it has copied a file to the destination but before it has removed the file from the source location. It is not possible to perform an atomic move across different file systems. Any of those possibilities should result in mv exiting non-zero and returning an error status to the caller. Most possibilities (not SIGKILL which cannot be trapped) will result in mv printing an error message to stderr. Generally if mv has an error there should be an error message and a non-zero exit status returned to the caller.
Bob
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#20091
; Package
coreutils
.
(Thu, 12 Mar 2015 22:27:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Bob Proulx <bob <at> proulx.com>
:
You have taken responsibility.
(Thu, 12 Mar 2015 22:31:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Rogers, Charles (MAN-Corporate-CON)" <Charles.Rogers <at> DealShield.com>
:
bug acknowledged by developer.
(Thu, 12 Mar 2015 22:31:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 20091-done <at> debbugs.gnu.org (full text, mbox):
Rogers, Charles (MAN-Corporate-CON) wrote:
> Thank you all so much for the explanation. It is as you describe.
>
> 1. We had insufficient permissions on the source directory
> 2. The destination directory was indeed on a different file system
Ah! All is explained.
> So, our question is answered, and again thanks.
Very good. I am glad it worked out for you. I will close this bug
ticket with this message then.
Bob
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 10 Apr 2015 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 68 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.