Hello,

I have found something which might be a bug in cpio.

Using version 2.9 of cpio I copied a complete partition 
using the command
   find . -depth -print | cpio -pdmuV /mnt 
and I received an warning:
   cpio: File xxxxx grew, 4294967296 new bytes not copied 
Looking at file xxxxx I verified, that it was completly 
and correctly copied. The file xxxxx has a size of nearly 
6 GB.

Looking closer to the source I found in util.c:

warn_if_file_changed (char *file_name, unsigned long old_file_size,
                      off_t old_file_mtime)
....
if (new_file_stat.st_size > old_file_size)
....

I suppose the if-condition is the point of problem because 
of comparing two different types.

I compiled cpio on my 32-bit SuSE linux system with support for large files.
According to my config.h there is
#define _FILE_OFFSET_BITS 64
/* #undef _LARGE_FILES */

Therefore I think that new_file_stat.st_size is of type off_t 
which is 64 bit because of _FILE_OFFSET_BITS. old_file_size is 
of tpye unsigned long, which is 32 bit because of my 32 bit linux 
system. Comparing a file size of 6GB using 64 bit with 6GB modulo 
32 bit resulted into 2^32, which is 4294967296 .


Hope this information will be useful,
  J. Begemann

 
_______________________________________________
Bug-cpio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-cpio

Reply via email to