[BusyBox] cp and mv bug in busybox-0.60.3 (and probably prior releases as well)

Peter Lassahn Peter.Lassahn at t-online.de
Sun Sep 1 14:26:02 UTC 2002


Dear Erik,

I'd like to report a finding on busybox-0.60.3:

Sometimes, however, quite seldomly cp refuses to copy a file from on
partition to another (e.g. from /dev/ram to /dev/hda2) when both files
exist. Filesystem is minix on both devices.
The error message is: '/ram/bin/xxx' and '/bin/xxx' are the same file.

It seems to be the case that both files have identical inode numbers.

The analysis leads to copy_file() in libbb/copy_file.c:
When checking both files for identity by means of the 'stat' structure,
_stat.st_rdev is used in addition to _stat.st_ino.
According to my opinion _stat.st_dev should be used instead of
_stat.st_rdev.

I'm not a specialist on that so I recommend that somebody else counterchecks
my proposal.

As mv also uses copy_file(), mv would be affected as well.

Best regards

Peter Lassahn

PS.: Please inform me if there is a better solution or if my solution is
totally wrong.




More information about the busybox mailing list