Date: Thu, 29 Apr 1999 12:41:16 -0700 (PDT) From: <adrian@FreeBSD.org> To: FreeBSD-gnats-submit@freebsd.org Subject: gnu/11389: tar reports incorrect total bytes written on >2 gig tars. Message-ID: <199904291941.MAA14341@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 11389 >Category: gnu >Synopsis: tar reports incorrect total bytes written on >2 gig tars. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 29 12:50:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Adrian Chadd >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: -current box build as of yesterday. >Description: Tar uses a int to store the bytes written count. This wraps at 2gig on the i386 platform. >How-To-Repeat: Create a tar with --totals with a size over 2 gig, and watch what is reported by tar at the end. >Fix: Change the counter to a u_quad_t using the following diff. diff -u -r -P /usr/src/gnu/usr.bin/tar/tar.c tar/tar.c --- /usr/src/gnu/usr.bin/tar/tar.c Mon Jul 27 20:40:08 1998 +++ tar/tar.c Tue Apr 6 20:02:47 1999 @@ -231,7 +231,7 @@ case CMD_CREATE: create_archive (); if (f_totals) - fprintf (stderr, "Total bytes written: %d\n", tot_written); + fprintf (stderr, "Total bytes written: %qu\n", tot_written); break; case CMD_EXTRACT: if (f_volhdr) diff -u -r -P /usr/src/gnu/usr.bin/tar/tar.h tar/tar.h --- /usr/src/gnu/usr.bin/tar/tar.h Mon Jul 27 20:40:09 1998 +++ tar/tar.h Tue Apr 6 20:04:31 1999 @@ -22,6 +22,12 @@ #include <sys/mknod.h> #endif +/* + * We need to include <sys/types.h> for the u_quad_t definition + */ + +#include <sys/types.h> + /* * Kludge for handling systems that can't cope with multiple * external definitions of a variable. In ONE routine (tar.c), @@ -168,7 +174,7 @@ TAR_EXTERN char *tar; /* Name of this program */ TAR_EXTERN struct sp_array *sparsearray; /* Pointer to the start of the scratch space */ TAR_EXTERN int sp_array_size; /* Initial size of the sparsearray */ -TAR_EXTERN int tot_written; /* Total written to output */ +TAR_EXTERN u_quad_t tot_written; /* Total written to output */ TAR_EXTERN struct re_pattern_buffer *label_pattern; /* compiled regex for extract label */ TAR_EXTERN char **ar_files; /* list of tape drive names */ >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?199904291941.MAA14341>