[BusyBox] mv is deleting files!

Denis Vlasenko vda at ilport.com.ua
Thu Jul 14 08:19:59 MDT 2005


On Thursday 14 July 2005 15:53, Josh Malone wrote:
> Rainer Weikusat wrote:
> > Steven Scholz <steven.scholz at imc-berlin.de> writes:
> > 
> > 
> >>Hi there,
> >>
> >>I just noticed something strange with busybux-1.00 mv command:
> >>
> >>~ # ls -l /opt/imc/idxcan
> >>ls: /opt/imc/idxcan: No such file or directory
> >>
> >>	[Ok. cause the file is not there yet.]
> >>
> >>~ # ls -l /tmp/idxcan
> >>-rw-r--r--    1 root     root      1154716 Jan  1 00:43 /tmp/idxcan
> >>
> >>	[This file will be moved to /opt/imc]
> >>
> >>~ # mv /tmp/idxcan /opt/imc/
> >>~ # ls -l /tmp/idxcan
> >>ls: /tmp/idxcan: No such file or directory
> >>~ # ls -l /opt/imc/idxcan
> >>-rw-r--r--    1 root     root      1154716 Jan  1 00:43 /opt/imc/idxcan
> >>
> >>	[OK. File was moved from /tmp to /opt/imc]
> >>
> >>~ # mv /tmp/idxcan /opt/imc/
> >>mv: /tmp/idxcan: No such file or directory
> >>
> >>	[Fair enough. Cause the file was moved.]
> >>
> >>~ # ls -l /opt/imc/idxcan
> >>ls: /opt/imc/idxcan: No such file or directory
> >>
> >>	[Oops!!! The mv that failed apparently deleted the target!]
> > 
> > 
> > I cannot reproduce this with 'my' busybox mv (which is some CVS/SVN
> > version after 1.00, but I didn't actually touch it yet).
> > 
> 
> 
> I can reproduce your test case exactly with my busybox-1.00:
> 
> adsdebian:~# ls -l /opt/imc/idxcan
> ls: /opt/imc/idxcan: No such file or directory
> adsdebian:~# ls -l /tmp/idxcan
> -rw-r--r--    1 root     root            7 Jan  1 00:02 /tmp/idxcan
> adsdebian:~# mv /tmp/idxcan /opt/imc/
> adsdebian:~# ls -l /tmp/idxcan
> ls: /tmp/idxcan: No such file or directory
> adsdebian:~# ls -l /opt/imc/idxcan
> -rw-r--r--    1 root     root            7 Jan  1 00:02 /opt/imc/idxcan
> adsdebian:~#  mv /tmp/idxcan /opt/imc/
> mv: /tmp/idxcan: No such file or directory
> adsdebian:~# ls -l /opt/imc/idxcan
> ls: /opt/imc/idxcan: No such file or directory
> adsdebian:~# ls -l /opt/
> drwxr-xr-x    2 root     root         1024 Jan  1 00:03 imc
> drwxr-xr-x    3 root     root         1024 Apr 28  2005 nanox
> adsdebian:~# ls -l /opt/imc
> adsdebian:~#
> 
> This is Busybox-1.00 on a ARM board with a ramdisk root.
> 
> However, slightly different test case doesn't reproduce the problem:

use for^Wstrace!
--
vda



More information about the busybox mailing list