Please review the following truss output. The bug (If it is indeed a bug)
seems to crop up with doing cp with the -Rf options, when copying files
that are the same atop one another. Although cp correctly identifies them
as identical, after that it unlinks the 'target' in preparation for a copy
that of course never happens, the end result being deletion of said file(s).

Output from cp --version:

cp (GNU fileutils) 4.0

Output from uname -a:

SunOS pacific.boldfish.com 5.7 Generic_106542-05 i86pc i386 i86pc

execve("/local/bin/cp", 0x08047AC4, 0x08047AD8)  argc = 4
open("/dev/zero", O_RDONLY)                     = 3
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xDFFE1000
sysconfig(_CONFIG_PAGESIZE)                     = 4096
open("/usr/lib/libgen.so.1", O_RDONLY)          = 4
fxstat(2, 4, 0x08047780)                        = 0
mmap(0x00000000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xDFFDF000
mmap(0x00000000, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xDFFD6000
mmap(0xDFFDC000, 4184, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 
20480) = 0xDFFDC000
close(4)                                        = 0
open("/usr/lib/libc.so.1", O_RDONLY)            = 4
fxstat(2, 4, 0x08047780)                        = 0
mmap(0xDFFDF000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0xDFFDF000
mmap(0x00000000, 593920, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xDFF44000
mmap(0xDFFCD000, 25448, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 
557056) = 0xDFFCD000
mmap(0xDFFD4000, 3316, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 
0xDFFD4000
close(4)                                        = 0
open("/usr/lib/libdl.so.1", O_RDONLY)           = 4
fxstat(2, 4, 0x08047780)                        = 0
mmap(0xDFFDF000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0xDFFDF000
close(4)                                        = 0
close(3)                                        = 0
sysi86(SI86FPHW, 0xDFFD4CE0, 0x08047A80, 0xDFFFCF1C) = 0x00000000
brk(0x08057900)                                 = 0
brk(0x08059900)                                 = 0
sigfillset(0xDFFD3CC4)                          = 0
sigprocmask(SIG_BLOCK, 0x080479B0, 0x00000000)  = 0
sigprocmask(SIG_BLOCK, 0x080479B0, 0x00000000)  = 0
sigprocmask(SIG_BLOCK, 0x080479B0, 0x00000000)  = 0
sigprocmask(SIG_UNBLOCK, 0x080479B0, 0x00000000) = 0
sigprocmask(SIG_UNBLOCK, 0x080479B0, 0x00000000) = 0
sigprocmask(SIG_UNBLOCK, 0x080479B0, 0x00000000) = 0
getuid()                                        = 1011 [1011]
umask(0)                                        = 022
lstat64("testme", 0x0804795C)                   = 0
stat64("testme", 0x080478BC)                    = 0
stat64("testme", 0x080476BC)                    = 0
stat64("testme", 0x0804761C)                    = 0
unlink("testme")                                = 0
open64("testme", O_RDONLY)                      Err#2 ENOENT
/local/bin/cpwrite(2, " / l o c a l / b i n / c".., 13) = 13
: write(2, " :  ", 2)                           = 2
`write(2, " `", 1)                              = 1
testmewrite(2, " t e s t m e", 6)                       = 6
' and `write(2, " '   a n d   `", 7)                    = 7
testmewrite(2, " t e s t m e", 6)                       = 6
' are the same filewrite(2, " '   a r e   t h e   s a".., 19)   = 19

write(2, "\n", 1)                               = 1
llseek(0, 0, SEEK_CUR)                          = 3965
llseek(0, 0, SEEK_CUR)                          = 3965
_exit(1)

Reply via email to