Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Mar 1996 00:05:16 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org (FreeBSD hackers)
Cc:        haug@conterra.com, brian.haug@columbiasc.ncr.com
Subject:   Re: changes to cpio
Message-ID:  <199603182305.AAA29026@uriah.heep.sax.de>
In-Reply-To: <199603171738.MAA03032@dorothy.columbiasc.attgis.com> from "Brian R. Haug" at Mar 17, 96 12:38:00 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Brian R. Haug wrote:
> The cpio utility gets into an infinite loop with the following input and
> command line:
> 	cpio -i <cpio.out2 a b
> 
> The cpio.out2 was constructed on a System V.4 system with the following
> command sequence:
> 	echo foo >a
> 	ln a b
> 	ln b c
> 	ls | cpio -oc >cpio.out2

Thanks.  Modulo some cosmetics (e.g. the function should be declared
`static'), your fix seems to be the right thing.  However :), it ain't
really the fix for the infinite loop, it's only that you (correctly!)
don't get to the spot where it loops infinitely.

The fix for the looping (which should only have been reached if there
were empty files in the archive) is:

@@ -1226,7 +1234,6 @@
 
   for (d = deferments; d != NULL; d = d->next)
     {
-      d = deferments;
       link_res = link_to_maj_min_ino (d->header.c_name,
 		    d->header.c_dev_maj, d->header.c_dev_maj,
 		    d->header.c_ino);

It's very obvious, ain't it? :)

I also had to introduce another variable that keeps track of the files
those creation has been deferred.  Their names should not be printed
again in the `verbose' case.

Btw., SysV doesn't grok its own archives. :-P  Its cpio cannot handle
all of the possible combinations on how to extract your given cpio
archive:

j@smiley 150% cpio -iv b c < cpio.out2
b
UX:cpio: WARNING: Cannot link "a" and "c":  No such file or directory
8 blocks

Sounds confusing, eh! :)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603182305.AAA29026>