From olli@lurza.secnetix.de  Tue Feb  6 09:03:39 2001
Return-Path: <olli@lurza.secnetix.de>
Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130])
	by hub.freebsd.org (Postfix) with ESMTP id 3291237B491
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  6 Feb 2001 09:03:38 -0800 (PST)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.9.3/8.9.3) id SAA53579;
	Tue, 6 Feb 2001 18:03:36 +0100 (CET)
	(envelope-from oliver.fromme@secnetix.de)
Message-Id: <200102061703.SAA53579@lurza.secnetix.de>
Date: Tue, 6 Feb 2001 18:03:36 +0100 (CET)
From: olli@secnetix.de
Reply-To: olli@secnetix.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: Patch to remove 32bit limit from tar
X-Send-Pr-Version: 3.2

>Number:         24903
>Category:       gnu
>Synopsis:       Patch to remove 32bit limit from tar
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 06 09:10:01 PST 2001
>Closed-Date:    Fri Jul 19 07:35:37 PDT 2002
>Last-Modified:  Fri Jul 19 07:35:37 PDT 2002
>Originator:     Oliver Fromme
>Release:        FreeBSD 4.2-20010124-STABLE i386
>Organization:
secnetix GmbH & Co KG
>Environment:

   FreeBSD -stable (and probably -current, too, but I
   haven't checked)

>Description:

   tar uses a variable of type "long" to store the amount
   of bytes written to the tape.  This means that the -L
   option (--tape-length) will fail for tapes > 2 Gbyte on
   i386 machines.

>How-To-Repeat:

   Try the following two commands (for the sake of this
   example, /dev/null is used instead of a real tape, so
   you can try it immediately):
   
   tar -c -f /dev/null -L 2097151 /bin
   tar -c -f /dev/null -L 2097152 /bin
   
   The first one specifies a "tape" length which is just a
   tiny bit smaller than 2 Gbyte.  It works fine.
   In the second command, the 32bit write counter overflows
   and leads to completely useless behaviour.
   
   After applying the fix below, both commands work fine.
   Tape sizes up to -- but not including -- 8 Ebytes (that
   is 8 million Tbytes) should work with this patch.  :)

>Fix:

--- src/gnu/usr.bin/tar/tar.h.orig	Thu Apr 29 21:59:24 1999
+++ src/gnu/usr.bin/tar/tar.h.new	Tue Feb  6 17:34:44 2001
@@ -208,7 +208,7 @@
 TAR_EXTERN int f_keep;         /* -k */
 TAR_EXTERN int f_startfile;    /* -K */
 TAR_EXTERN int f_local_filesys;        /* -l */
-TAR_EXTERN int tape_length;    /* -L */
+TAR_EXTERN off_t tape_length;  /* -L */
 TAR_EXTERN int f_modified;     /* -m */
 TAR_EXTERN int f_multivol;     /* -M */
 TAR_EXTERN int f_new_files;    /* -N */
--- src/gnu/usr.bin/tar/buffer.c.orig	Wed Jan 11 05:18:37 1995
+++ src/gnu/usr.bin/tar/buffer.c.new	Tue Feb  6 17:35:09 2001
@@ -744,7 +744,7 @@
 {
   int err;
   int copy_back;
-  static long bytes_written = 0;
+  static off_t bytes_written = 0;
 
   if (f_checkpoint && !(++checkpoint % 10))
     msg ("Write checkpoint %d\n", checkpoint);


>Release-Note:
>Audit-Trail:

From: Marc Perisa <perisa@porsche.de>
To: freebsd-gnats-submit@FreeBSD.org
Cc: olli@secnetix.de
Subject: Re: gnu/24903: Patch to remove 32bit limit from tar
Date: Wed, 29 May 2002 02:47:01 +0200

 This problem is know with this version of tar.
 
 I updated the patch for buffer.c - but NOT tested it. There was no 
 changes to tar.h as far as I can see on my system
 FreeBSD cerberus.home.sumirati.de 4.5-STABLE FreeBSD 4.5-STABLE #2: Mon 
 Mar 18 12:35:37 CET 2002
 
 --- buffer.c.orig       Wed May 29 02:11:56 2002
 +++ buffer.c.new        Wed May 29 02:13:01 2002
 @@ -746,7 +746,7 @@
  {
    int err;
    int copy_back;
 -  static long bytes_written = 0;
 +  static off_t bytes_written = 0;
  
    if (f_checkpoint && !(++checkpoint % 10))
      msg ("Write checkpoint %d\n", checkpoint);
 
 Another solution is to included a newer version of gnu tar as discussed 
 in stable
 http://docs.freebsd.org/cgi/getmsg.cgi?fetch=423267+0+archive/2002/freebsd-stable/20020519.freebsd-stable
 
 Related PRs are:
 http://www.freebsd.org/cgi/query-pr.cgi?pr=3552
 http://www.freebsd.org/cgi/query-pr.cgi?pr=gnu/3553   (already closed)
 http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/28820
 http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/21208
 
 I send a close request to those since this is the most promising one.
 
 Thanks
 
 Marc
 
 
 

From: Oliver Fromme <oliver.fromme@secnetix.de>
To: perisa@porsche.de (Marc Perisa)
Cc: freebsd-gnats-submit@FreeBSD.org, olli@secnetix.de
Subject: Re: gnu/24903: Patch to remove 32bit limit from tar
Date: Wed, 29 May 2002 08:44:32 +0200 (CEST)

 Marc Perisa wrote:
  > [...]
  > Related PRs are:
  > http://www.freebsd.org/cgi/query-pr.cgi?pr=3552
  > http://www.freebsd.org/cgi/query-pr.cgi?pr=gnu/3553   (already closed)
 
 The patch fixes the above two, but _not_ the following two:
 
  > http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/28820
  > http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/21208
 
 (I haven't actually tested the latter, but deduced it from
 the source that they won't be fixed.)
 
 Regards
    Oliver
 
 -- 
 Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 Mnchen
 Any opinions expressed in this message may be personal to the author
 and may not necessarily reflect the opinions of secnetix in any way.
 
 "All that we see or seem is just a dream within a dream" (E. A. Poe)
State-Changed-From-To: open->patched 
State-Changed-By: sobomax 
State-Changed-When: Tue Jun 4 10:56:20 PDT 2002 
State-Changed-Why:  
Modern GNU tar which was just imported into the -CURRENT doesn't have this 
problem. Therefore, the problem will befilly resolved when tar upgrade is 
MFC'ed in about 1 month. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24903 
State-Changed-From-To: patched->closed 
State-Changed-By: jon 
State-Changed-When: Fri Jul 19 07:35:20 PDT 2002 
State-Changed-Why:  
duplicate pr. 

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