[BusyBox] Problem with cp (copy_file)

Laure-Amelie Couturie Laure-Amelie.Couturie at idris.fr
Tue Jun 11 07:44:05 MDT 2002


"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.

Thanks for your busybox project; we use it every day.

-- 
Laure-Amélie Couturié








More information about the busybox mailing list