From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 30 19:30:10 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 A3D921065672 for ; Sun, 30 Mar 2008 19:30:10 +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 85E4D8FC18 for ; Sun, 30 Mar 2008 19:30:10 +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 m2UJUAb4088336 for ; Sun, 30 Mar 2008 19:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m2UJUAWm088332; Sun, 30 Mar 2008 19:30:10 GMT (envelope-from gnats) Date: Sun, 30 Mar 2008 19:30:10 GMT Message-Id: <200803301930.m2UJUAWm088332@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: Sun, 30 Mar 2008 19:30:10 -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: Sun, 30 Mar 2008 22:28:55 +0300 --huq684BweRXVnRxX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi, On 2008-03-23, Derek Kuliński wrote: > Now I tried to your suggestion and it seems to work as it supposed to > with the gzip from ports. Well.. I see the "Header with wrong > dumpdate." but other than that it works fine. This is a separate bug. See the PR bin/118087 (http://www.freebsd.org/cgi/query-pr.cgi?pr=118087). On 2008-03-24, Derek Kuliński wrote: > One more thing, before patching, there's a different behavior: Here's a patch that keeps the behavior same. The patch just enables the short read code in readtape() (tape.c) when -P is used. There's still obviously wrong code related to -P option in getvol(). I have marked it with XXX comment. -- Jaakko --huq684BweRXVnRxX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="restore-pipecmdin.diff" Index: tape.c =================================================================== RCS file: /home/ncvs/src/sbin/restore/tape.c,v retrieving revision 1.49 diff -p -u -r1.49 tape.c --- tape.c 6 Mar 2007 08:13:20 -0000 1.49 +++ tape.c 30 Mar 2008 17:17:11 -0000 @@ -333,6 +333,12 @@ getvol(long nextvol) } if (volno == 1) return; + /* + * XXX: Following if branch is never reached because pipein + * XXX: and pipecmdin are never set at the same time. + * XXX: Secondly the goto to getpipecmdhdr can't be correct + * XXX: because it skips the code where newvol is initialized. + */ if (pipecmdin) { closemt(); goto getpipecmdhdr; @@ -1202,17 +1208,17 @@ getmore: * Check for mid-tape short read error. * If found, skip rest of buffer and start with the next. */ - if (!pipein && numtrec < ntrec && i > 0) { + if ((!pipein && !pipecmdin) && numtrec < ntrec && i > 0) { dprintf(stdout, "mid-media short read error.\n"); numtrec = ntrec; } /* * Handle partial block read. */ - if (pipein && i == 0 && rd > 0) + if ((pipein || pipecmdin) && i == 0 && rd > 0) i = rd; else if (i > 0 && i != ntrec * TP_BSIZE) { - if (pipein) { + if (pipein || pipecmdin) { rd += i; cnt -= i; if (cnt > 0) --huq684BweRXVnRxX--