bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cpio pass-through can corrupt files


From: Parrott, Jeff
Subject: cpio pass-through can corrupt files
Date: Mon, 16 Oct 2000 13:32:57 -0400

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 current
file. 

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.
Jeff Parrott
Siemens Energy & Automation, Inc.
(423) 461-2470
(423) 461-2174 (Fax)
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]