From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 25 09:20:05 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6607A1065676 for ; Tue, 25 Mar 2008 09:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 477028FC15 for ; Tue, 25 Mar 2008 09:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m2P9K5Ne033908 for ; Tue, 25 Mar 2008 09:20:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m2P9K5Rs033907; Tue, 25 Mar 2008 09:20:05 GMT (envelope-from gnats) Date: Tue, 25 Mar 2008 09:20:05 GMT Message-Id: <200803250920.m2P9K5Rs033907@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: bin/121502: option -P appears to be broken in restore(8) since FreeBSD 6.3 (regression) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Mar 2008 09:20:05 -0000 The following reply was made to PR bin/121502; it has been noted by GNATS. From: Jaakko Heinonen To: Derek =?utf-8?B?S3VsacWEc2tp?= Cc: bug-followup@FreeBSD.org, green@FreeBSD.org Subject: Re: bin/121502: option -P appears to be broken in restore(8) since FreeBSD 6.3 (regression) Date: Tue, 25 Mar 2008 11:10:20 +0200 Hi, On 2008-03-24, Derek KuliƄski wrote: > One more thing, before patching, there's a different behavior: > When I use it with gzip from ports, it behaves pretty much like it did > in the past (asking for the volume number) Looking at the source code the behavior after patching might be correct: (tape.c) 308 if (pipein) { 309 if (nextvol != 1) { 310 panic("Changing volumes on pipe input?\n"); 311 /* Avoid looping if we couldn't ask the user. */ 312 if (yflag || ferror(terminal) || feof(terminal)) 313 done(1); 314 } 315 if (volno == 1) 316 return; 317 if (pipecmdin) { 318 closemt(); 319 goto getpipecmdhdr; 320 } 321 goto gethdr; 322 } In unpatched restore(8) pipein and pipecmdin are never set at the same time. Thus the code never reaches line 319 which causes restore(8) to skip "Specify next volume #: " prompt. (When volno == 1 it's already skipped at line 316.) However looking at it more carefully the goto on line 319 can't be correct either because then newvol will be uninitialized at line 409. Seems that -P has been broken since it's introduction to tape.c revision 1.39. I have cc'd green@ who committed the revision 1.39. He should know what the intended behavior is. (Please see http://www.freebsd.org/cgi/query-pr.cgi?pr=121502 what we have found out so far.) -- Jaakko