Date: Wed, 15 Oct 1997 12:50:01 -0700 (PDT) To: jhs@ From: FreeBSD-gnats@_ERASE_FreeBSD.ORG Subject: Re: gnu/4771: diff -c for src/gnu/usr.bin/tar/tar.c FreeBSD 2.2.2-RELEASE Thank you very much for your problem report. It has the internal identification `gnu/4771'. The individual assigned to look at your report is: freebsd-bugs. >Category: gnu >Responsible: freebsd-bugs >Synopsis: diff to correct misleading total bytes info. >Arrival-Date: Wed Oct 15 12:50:01 PDT 1997 SEND-PR: -*- send-pr -*- SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as SEND-PR: will all comments (text enclosed in `<' and `>'). SEND-PR: SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo SEND-PR: manual if you are not sure how to fill out a problem report. SEND-PR: SEND-PR: Note that the Synopsis field is mandatory. The Subject (for SEND-PR: the mail) will be made the same as Synopsis unless explicitly SEND-PR: changed. SEND-PR: SEND-PR: Choose from the following categories: SEND-PR: SEND-PR: bin conf docs gnu i386 kern misc ports SEND-PR: To: FreeBSD-gnats-submit@_ERASE_freebsd.org Subject: diff -c for src/gnu/usr.bin/tar/tar.c FreeBSD 2.2.2-RELEASE From: jhs@ Reply-To: jhs@ X-send-pr-version: 3.2 >Submitter-Id: current-users >Originator: Julian Stacey Confidential: no >Synopsis: diff to correct misleading total bytes info. >Severity: non-critical >Priority: low >Category: gnu >Release: FreeBSD 2.2.2-RELEASE i386 >Class: change-request >Environment: FreeBSD 2.2.2-RELEASE i386 >Description: Fix for misleading byte count info. from gnu tar. >How-To-Repeat: cd /usr/src/gnu/usr.bin/tar patch -p5 < diff.jhs ; make ; make install tar -c -f - --totals . | dd of=/dev/null tar:Total bytes written: 952320 dd:1860+0 records in dd:1860+0 records out dd:952320 bytes transferred in 0.054882 secs (17352122 bytes/sec) tar -z -c -f - --totals . | dd of=/dev/null tar:Total bytes written: 952320 dd:671+1 records in dd:671+1 records out dd:343978 bytes transferred in 3.607535 secs (95350 bytes/sec) One can see the truth from dd, but tar itself lies to us. My diff changes tar:Total bytes written: 952320 to tar:Total bytes written (to compressor, not to media): 952320 Why I bother to fix it: On another occasion it said ~550M to me when it had really only written ~250M to my tape, as my qic-525 only takes about 540M i thought I'd hit end of tape, not so, gnu tar just misleads us about how much its proxy gzip is writing. >Fix: I'm too busy to change the the code, to count bytes written out from the compressor (I suspect that would be very hard, pipes'nall & anyway it's a 3rd party gnu product. My patch below corrects the information label returned by the command. Appropriate for FreeBSD 2.2.2-RELEASE ------ FreeBSD-2.2.8 # *** old/src/gnu/usr.bin/tar/tar.c Tue Jan 7 11:44:53 1997 # --- new/src/gnu/usr.bin/tar/tar.c Tue Oct 14 14:35:12 1997 # *************** # *** 230,236 **** # case CMD_CREATE: # create_archive (); # if (f_totals) # ! fprintf (stderr, "Total bytes written: %d\n", tot_written); # break; # case CMD_EXTRACT: # if (f_volhdr) # --- 230,240 ---- # case CMD_CREATE: # create_archive (); # if (f_totals) # ! fprintf (stderr, "Total bytes written%s: %d\n", # ! (f_compressprog) ? # ! " (to compressor, not to media)" # ! : "" , # ! tot_written); # break; # case CMD_EXTRACT: # if (f_volhdr) ------- FreeBSD-3.2 # *** old/src/gnu/usr.bin/tar/tar.c Thu Apr 29 22:00:46 1999 # --- new/src/gnu/usr.bin/tar/tar.c Fri May 21 21:25:16 1999 # *************** # *** 233,239 **** # case CMD_CREATE: # create_archive (); # if (f_totals) # ! fprintf (stderr, "Total bytes written: %qu\n", tot_written); # break; # case CMD_EXTRACT: # if (f_volhdr) # --- 233,243 ---- # case CMD_CREATE: # create_archive (); # if (f_totals) # ! fprintf (stderr, "Total bytes written%s: %d\n", # ! (f_compressprog) ? # ! " (to compressor, not to media)" # ! : "" , # ! tot_written); # break; # case CMD_EXTRACT: # if (f_volhdr) The patch above no longer applies to FreeBSD-4.7 src/contrib/tar/src/buffer.c I havent had time to check if a patch is needed. Julian -- Julian H. Stacey Home