From owner-freebsd-hackers Mon Mar 18 15:12:29 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA11346 for hackers-outgoing; Mon, 18 Mar 1996 15:12:29 -0800 (PST) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA11334 for ; Mon, 18 Mar 1996 15:12:23 -0800 (PST) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id AAA14102; Tue, 19 Mar 1996 00:11:29 +0100 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id AAA18256; Tue, 19 Mar 1996 00:11:12 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.7.4/8.6.9) id AAA29026; Tue, 19 Mar 1996 00:05:16 +0100 (MET) From: J Wunsch Message-Id: <199603182305.AAA29026@uriah.heep.sax.de> Subject: Re: changes to cpio To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Tue, 19 Mar 1996 00:05:16 +0100 (MET) Cc: haug@conterra.com, brian.haug@columbiasc.ncr.com Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199603171738.MAA03032@dorothy.columbiasc.attgis.com> from "Brian R. Haug" at Mar 17, 96 12:38:00 pm X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL24 ME8a] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk As Brian R. Haug wrote: > The cpio utility gets into an infinite loop with the following input and > command line: > cpio -i > 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. ;-)