[BusyBox] Problem with cp (copy_file)

Matt Kraai kraai at alumni.cmu.edu
Tue Jun 11 07:26:12 UTC 2002


On Tue, Jun 11, 2002 at 02:43:46PM +0200, Laure-Amelie Couturie wrote:
> "busybox cp" complain "cp file1 and file2 are same file" when file1 and file2 
> have same inode number on two different file system.
> 
> In the source file busybox/libbb/copy_file.c I add at line 59 the test for the 
> device
> (source_stat.st_dev):
> 
>  if (dest_exists && source_stat.st_rdev == dest_stat.st_rdev && 
> source_stat.st_dev == dest_stat.st_dev && source_stat.st_ino == 
> dest_stat.st_ino) {
>         error_msg("`%s' and `%s' are the same file", source, dest);
>         return -1;
>     }
> 
> Now it works. Perhaps it should be a bug report for the cp implementation.

...and we can remove the st_rdev check as well.  Thanks for the
report, fixed in CVS.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20020611/00daee30/attachment.pgp 


More information about the busybox mailing list