[BusyBox] Another bug(?) in cp

Brian Webb webbb at desertscenes.net
Sat Apr 28 09:58:51 UTC 2001


I'm not sure if this is a bug, but it works different than on my 
desktop,so I think it is.  The problem is that "cp -a" uses the umask when 
copying devide files, so "cp -a" does not preserve complete file 
permissions.  I'm not sure exactly how it should work, but on my desktop I 
can copy my /dev directory with "cp -a" and all permissions are preserved. 
 Also it seems reasonable for "cp -a" or "cp -p" to work that way.

The following is a patch that fixes the problem (at least it works for 
me).  It looks a little different than the other, similar code around it, 
but it seems to me like it should be correct.

Thanks,

Brian


cvs server: Diffing .
Index: copy_file.c
===================================================================
RCS file: /var/cvs/busybox/libbb/copy_file.c,v
retrieving revision 1.7
diff -r1.7 copy_file.c
181a182,186
> 		mode_t saved_umask = 0;
> 
> 		if (flags & FILEUTILS_PRESERVE_STATUS)
> 			saved_umask = umask(0);
> 
184a190,193
> 
> 		if (flags & FILEUTILS_PRESERVE_STATUS)
> 			umask(saved_umask);
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 
Type: application/octet-stream
Size: 2 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20010428/5774e584/attachment-0001.obj 


More information about the busybox mailing list