Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 1997 15:23:21 +0200 (MET DST)
From:      jhs@FreeBSD.ORG
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   gnu/4771: diff -c for src/gnu/usr.bin/tar/tar.c FreeBSD 2.2.2-RELEASE
Message-ID:  <199710141323.PAA20799@flip.jhs.no_domain>
Resent-Message-ID: <199710151950.MAA19686@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4771
>Category:       gnu
>Synopsis:       diff to correct misleading total bytes info.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 15 12:50:01 PDT 1997
>Last-Modified:
>Originator:     Julian Stacey <jhs@freebsd.org>
>Organization:
>Release:        FreeBSD 2.2.2-RELEASE i386
>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

*** 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)
Julian
--
Julian H. Stacey
Home <jhs@freebsd.org>     http://www.freebsd.org/~jhs/     Tel. +49 89 268616	
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710141323.PAA20799>