Date: Tue, 6 Feb 2001 18:03:36 +0100 (CET) From: olli@secnetix.de To: FreeBSD-gnats-submit@freebsd.org Subject: gnu/24903: Patch to remove 32bit limit from tar Message-ID: <200102061703.SAA53579@lurza.secnetix.de>
next in thread | raw e-mail | index | archive | help
>Number: 24903 >Category: gnu >Synopsis: Patch to remove 32bit limit from tar >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Feb 06 09:10:01 PST 2001 >Closed-Date: >Last-Modified: >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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102061703.SAA53579>