Subject: bin/6948: multi-volume gnu/usr.bin/tar fails for volumes larger than 2GB
To: None <gnats-bugs@gnats.netbsd.org>
From: Ed Gould <ed@left.wing.org>
List: netbsd-bugs
Date: 02/05/1999 17:17:51
>Number: 6948
>Category: bin
>Synopsis: multi-volume gnu/usr.bin/tar fails for volumes larger than 2GB
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Feb 5 17:20:00 1999
>Last-Modified:
>Originator: Ed Gould
>Organization:
--
Ed Gould Palo Alto Advanced Development Compaq Computer Corp.
+1 650 853 2108 ed@pa.dec.com 130 Lytton Avenue
ed.gould@compaq.com Palo Alto, CA 94301
>Release: 1.3.2, but still true in -current
>Environment:
System: NetBSD left.wing.org 1.3.2 NetBSD 1.3.2 (LEFT) #8: Wed Dec 2 10:00:01 PST 1998 ed@left.wing.org:/usr/src/netbsd-1.3.2/sys/arch/i386/compile/LEFT i386
>Description:
The -L flag takes a byte count (in 1K units) of the length of tape.
The arithmetic to evaluate when to change volumes is done in a signed
long. Hence it fails for sizes of 2GB or greater.
>How-To-Repeat:
Use the -L flag to specify a tape length >= 2GB (e.g., -L 2097152)
and watch tar fail.
>Fix:
This fix is good for sizes under 4GB. 64-bit arithmetic would be
even better.
--- buffer.c.orig Mon May 4 23:35:51 1998
+++ buffer.c Fri Feb 5 10:35:33 1999
@@ -748,11 +748,11 @@
{
int err;
int copy_back;
- static long bytes_written = 0;
+ static unsigned long bytes_written = 0;
if (f_checkpoint && !(++checkpoint % 10))
msg ("Write checkpoint %d\n", checkpoint);
- if (tape_length && bytes_written >= tape_length * 1024)
+ if (tape_length && (bytes_written >= (tape_length * (unsigned long)1024)))
{
errno = ENOSPC;
err = 0;
>Audit-Trail:
>Unformatted: