Red Hat Bugzilla – Bug 19279
cpio pass-through faulty if file grows during copy
Last modified: 2007-04-18 12:29:23 EDT
This has been reported by me to firstname.lastname@example.org and logged
as a cpio maintenance request. I thought you might like to know.
I have seen corrupted files as a result of using the pass-through option
in cpio. The corruption occurs when active/in-use (and growing) files are
being copied. The problem is that the file size has grown since the time
of the stat() call (made in process_copy_pass). This will give you more
bytes than you expect in the last read and as a result on the next call to
copy_files_disk_to_disk() you will have "input_size" not starting at zero
and you will get the ending bytes from the last file copied into the
So the problem is two-fold 1) you do not get the complete file copied; and
2) you get parts of one file copied to another!
For my purposes, I have rewritten copy_files_disk_to_disk() to ignore the
num_bytes input parameter and to just copy until EOF. The problem might
also appear in other parts of the cpio source. I have rewritten it to
serve my purposes for the moment (to suit my needs given the heavy
schedule pressure I am under). I think you should make a more thorough
code inspection to insure all problems of this nature are fixed
accordingly in the complete cpio source.
Could you include a copy of your patch to cpio as an attachment? Thanks.
Closing due to inactivity
Created attachment 19912 [details]
Includes my modifications to correct bug 19279-sorry for the delay.
Thanks, fixed in 2.4.2-23