From CQG00620@nifty.ne.jp  Wed May 19 05:38:14 2004
Return-Path: <CQG00620@nifty.ne.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CA03F16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 May 2004 05:38:14 -0700 (PDT)
Received: from mail500.nifty.com (mail500.nifty.com [202.248.37.208])
	by mx1.FreeBSD.org (Postfix) with ESMTP id F2B0543D1F
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 May 2004 05:38:13 -0700 (PDT)
	(envelope-from CQG00620@nifty.ne.jp)
Received: from nifty.ne.jp (ntceast009065.east.dup.ppp.infoweb.ne.jp [220.209.198.65])by mail500.nifty.com with ESMTP id i4JCbkpT004389
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 May 2004 21:37:47 +0900
Message-Id: <200405191237.i4JCbkpT004389@mail500.nifty.com>
Date: Wed, 19 May 2004 21:39:35 +0900
From: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
Reply-To: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] Cannot extract tar(1) multi-volume archive on floppy drive.

>Number:         66876
>Category:       kern
>Synopsis:       [fdc] [patch] Cannot extract tar(1) multi-volume archive on floppy drive.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 19 05:40:08 PDT 2004
>Closed-Date:    Sun Jun 17 10:10:40 GMT 2007
>Last-Modified:  Sun Jun 17 10:10:40 GMT 2007
>Originator:     Watanabe Kazuhiro
>Release:        FreeBSD 5.2.1-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD pisces.zodiac.org 5.2.1-RELEASE-p5 FreeBSD 5.2.1-RELEASE-p5 #0: Tue May 18 00:19:57 JST 2004 nabe@pisces.zodiac.org:/opt/obj/usr/src/sys/VASH i386

(Floppy drive)
fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0

This PC is dual-booting FreeBSD 4.7-RELEASE and 5.2.1-RELEASE.

>Description:
I can make tar(1) multi-volume archive on floppy drive.
It can be extracted with FreeBSD 4.7-RELEASE.

But the archive cannot be extracted a same PC with
FreeBSD 5.2.1-RELEASE.

>How-To-Repeat:
(Floppy media: 1.44M/2HD)
# dd if=/dev/zero bs=2m count=1 > test.data
# ls -l test.data
-rw-r--r--  1 root  wheel  2097152 May 19 11:49 test.data
# tar cfM /dev/fd0 test.data
Prepare volume #2 for `/dev/fd0' and hit return: 
(Change a medium #2, and the command finished normally)
(Change a medium #1)
# tar xfM /dev/fd0 -C /tmp
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: /dev/fd0: Cannot read: Invalid argument
tar: Too many errors, quitting
tar: Error is not recoverable: exiting now
# ls -l /tmp/test.data
-rw-r--r--  1 root  wheel  1474048 May 19 11:53 /tmp/test.data
#

>Fix:
--- /sys/isa/fd.c.orig	Thu Oct 23 14:52:52 2003
+++ /sys/isa/fd.c	Wed May 19 11:59:35 2004
@@ -1725,7 +1725,7 @@
 	/*
 	 * Set up block calculations.
 	 */
-	if (bp->bio_offset >= ((off_t)128 << fd->ft->secsize) * fd->ft->size) {
+	if (bp->bio_offset > ((off_t)128 << fd->ft->secsize) * fd->ft->size) {
 		bp->bio_error = EINVAL;
 		bp->bio_flags |= BIO_ERROR;
 		goto bad;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: gavin 
State-Changed-When: Thu Jun 14 16:58:22 UTC 2007 
State-Changed-Why:  

To submitter: Is this still an issue on more recent versions of 
FreeBSD?  If so, do you get any errors in /var/log/messages? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66876 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Sun Jun 17 10:10:38 UTC 2007 
State-Changed-Why:  
Submitter reports this had been fixed/unreproduceable for recent 
versions of FreeBSD 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66876 
>Unformatted:
