From nobody  Fri Dec 18 07:44:47 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id HAA21805;
          Fri, 18 Dec 1998 07:44:47 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199812181544.HAA21805@hub.freebsd.org>
Date: Fri, 18 Dec 1998 07:44:47 -0800 (PST)
From: rtm@eecs.harvard.edu
To: freebsd-gnats-submit@freebsd.org
Subject: pax can't read tar archives that contain files > 4GB
X-Send-Pr-Version: www-1.0

>Number:         9123
>Category:       bin
>Synopsis:       pax can't read tar archives that contain files > 4GB
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 18 07:50:01 PST 1998
>Closed-Date:    Tue Oct 23 09:16:00 UTC 2007
>Last-Modified:  Tue Oct 23 09:16:00 UTC 2007
>Originator:     Robert Morris
>Release:        2.2.6
>Organization:
Harvard University
>Environment:
FreeBSD frenulum.eecs.harvard.edu 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Sat Sep  5 09:53:19 EDT 1998     rtm@frenulum.eecs.harvard.edu:/sys/compile/FRENULUM  i386
>Description:
pax treats the 12-digit octal file length field in the tar
per-file header as if it fit into a 32-bit int.
>How-To-Repeat:
Create a tar archive containing a file longer than 4GB.
Try to read the archive with pax.
>Fix:
Change /usr/src/bin/pax/tar.c:

460c460
<       arcn->sb.st_size = (size_t)asc_ul(hd->size, sizeof(hd->size), OCT);
---
>       arcn->sb.st_size = asc_uqd(hd->size, sizeof(hd->size), OCT);
841c841
<       arcn->sb.st_size = (size_t)asc_ul(hd->size, sizeof(hd->size), OCT);
---
>       arcn->sb.st_size = asc_uqd(hd->size, sizeof(hd->size), OCT);

>Release-Note:
>Audit-Trail:

From: adrian@freebsd.org
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/9123 pax can't read tar archives that contain files >4GB
Date: Wed, 11 Aug 1999 22:47:32 +0800

 The patch submitted works fine as far as I can tell, however I'd be
 tempted to typecast it to off_t since that is what st_size wants.
 
 
 Index: tar.c
 ===================================================================
 RCS file: /home/ncvs/src/bin/pax/tar.c,v
 retrieving revision 1.12
 diff -u -r1.12 tar.c
 --- tar.c       1999/05/08 10:21:20     1.12
 +++ tar.c       1999/08/11 14:24:07
 @@ -459,7 +459,7 @@
             0xfff);
         arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
         arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
 -       arcn->sb.st_size = (size_t)asc_ul(hd->size, sizeof(hd->size), OCT);
 +       arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
         arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
         arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
  
 @@ -840,7 +840,7 @@
          */
         arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
             0xfff);
 -       arcn->sb.st_size = (size_t)asc_ul(hd->size, sizeof(hd->size), OCT);
 +       arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
         arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
         arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
 
 See if it works for you, if it does, let me know and it should be committed.
 
 
 Adrian
 
 
State-Changed-From-To: open->analyzed 
State-Changed-By: kris 
State-Changed-When: Thu May 24 13:01:12 PDT 2001 
State-Changed-Why:  
This has been fixed in -current. I'll close this PR when 
I MFC the changes to pax. 


Responsible-Changed-From-To: freebsd-bugs->kris 
Responsible-Changed-By: kris 
Responsible-Changed-When: Thu May 24 13:01:12 PDT 2001 
Responsible-Changed-Why:  
I imported the new version 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=9123 
Responsible-Changed-From-To: kris->freebsd-bugs 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Aug 23 21:14:35 PDT 2002 
Responsible-Changed-Why:  
I won't have time to look at this any time soon 

http://www.freebsd.org/cgi/query-pr.cgi?pr=9123 

From: Tim Kientzle <kientzle@freebsd.org>
To: freebsd-gnats-submit@freebsd.org, rtm@eecs.harvard.edu
Cc: Kris Kennaway <kris@freebsd.org>
Subject: Re: bin/9123: pax can't read tar archives that contain files > 4GB
Date: Sun, 25 Jul 2004 10:32:21 -0700

 http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/9123
 
 Is this still a problem?  I've tested it and it looks
 fixed in -CURRENT (as of a couple of years ago).
 
 (Of course, pax still can't handle entries >=8g,
 a limitation not present in bsdtar, star, or even
 gtar.  Maybe it's time to start on a libarchive-based
 pax implementation. ;-)
 
 If there are no objections, I'll close this.
 
 Tim
 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@freebsd.org,  rtm@eecs.harvard.edu
Cc: kientzle@freebsd.org
Subject: Re: bin/9123: pax can't read tar archives that contain files > 4GB
Date: Mon, 22 Oct 2007 20:02:39 +0100

 I've just tested this on 7.0-PRERELEASE from 14th October.  After 
 creating a 12GB file and tarring it up using bsdtar, pax was able to 
 extract it and produce a file of the same size as the original.
 
 --
 Bruce Cran
State-Changed-From-To: analyzed->closed 
State-Changed-By: kientzle 
State-Changed-When: Tue Oct 23 09:15:05 UTC 2007 
State-Changed-Why:  
Thanks to Bruce Cran for testing this; it seems to have been 
fixed about 6 years ago. 
Closing it now. 

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