[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-cpio] cpio 2.4.2 put NULL pad in the middle of a file header
From: |
Matthew Braithwaite |
Subject: |
[Bug-cpio] cpio 2.4.2 put NULL pad in the middle of a file header |
Date: |
Mon, 16 Aug 2004 12:58:17 -0700 (PDT) |
cpio 2.4.2, on RedHat Linux 7.3, invoked as:
cpio --quiet --format=crc -o
gave me the following message:
cpio: File <long file name> shrunk by 13906 bytes, padding with zeros
On attempting to extract the archive, cpio said:
cpio: cannot remove current <first half of filename>: Directory not empty
cpio: warning: skipped 28160 bytes of junk
I opened the archive in Emacs and searched for the <long file name>.
I found:
<first half of filename>
<42066 null bytes>
<second half of filename>
Looking at util.c I can make a guess about why this happened, and if
my guess is correct the problem would also be present in version 2.5.
For most output, the functions copy_files_disk_to_*() call
*_buffered_write() -- which functions of course buffer. However, when
cpio emits the error message above, it calls write_nuls_to_file(),
which does *not* buffer:
blocks = num_bytes / 512;
extra_bytes = num_bytes % 512;
for (i = 0; i < extra_bytes; ++i)
{
if (write (out_des, zeros_512, 512) != 512)
error (1, errno, "error writing NUL's");
}
if (extra_bytes != 0)
{
if (write (out_des, zeros_512, extra_bytes) != extra_bytes)
error (1, errno, "error writing NUL's");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-cpio] cpio 2.4.2 put NULL pad in the middle of a file header,
Matthew Braithwaite <=