[BusyBox] cpio, empty files, sequence

Frank Lenaerts lenaerts.frank at pandora.be
Wed Apr 28 19:32:23 UTC 2004


Hi,

I found a problem with Busybox cpio. After hours trying to find the
cause, trying to work around it, ... I finally have some more
information.

When I unpacked a cpio archive (created with GNU cpio) containing an
empty file, I suddenly got an error message:

--- begin ---
cpio: Couldnt create hard link: No such file or directory
chown: /./var/lib/ntp/ntp.drift: No such file or directory
---  end  ---

The /var/lib/ntp/ntp.drift file was the empty file in the cpio archive
and it was not unpacked. At first, I thought it was just because of
the fact that this file was empty. The problem did not occur when the
file contained something. BTW, GNU cpio did not have any problem
handling this situation.

I wanted this file however to be empty. In addition, I also noticed
the "Couldnt create hard link" some time ago but I didn't have the
time to investigate it further at that moment. 

I therefore decided to start playing around with empty files and cpio
archives. To my surprise, busybox cpio didn't have any troubles at all
unpacking archives containing empty files (created with GNU cpio). It
seemed as if only that particular cpio archive had problems. I didn't
believe this but had to admit it after some time. 

I manually generated the cpio archive, compared the contents of this
one with the one having troubles (cat <archive> | cpio -it | sort) to
verify if they both contained the same files. I then unpacked the
archives. To my surprise, the manually generated archive didn't have
any problem at all. I then cmp-ed both archives: the first line was
different. I then changed my makefile for the automatically generated
makefile to create the archive identically as the one I generated
manually i.e. using the same sequence of filenames. Now, the generated
cpio archive containing the empty file can be unpacked without any
problem.

So, it seems the sequence of filenames used to create a cpio archive
(using GNU cpio) is important for Busybox cpio to be able to unpack
it. In addition, this problem only seems to occur if a cpio archive
contains an empty file.

Anyone any idea? If you need more information, an example of a bad and
its corresponding good list of filenames, let me know.

BTW: I am using BusyBox v1.00-pre10

-- 
lenaerts.frank at pandora.be

gpg fingerprint: A41E A399 5160 BAB9 AEF1  58F2 B92A F4AB 9FFB 3707
gpg key id: 9FFB3707

Those who do not understand Unix are condemned to reinvent it, poorly."
-- Henry Spencer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20040428/ac84778b/attachment-0002.pgp 


More information about the busybox mailing list