bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] shaking the nulls


From: Dan Jacobson
Subject: [Bug-tar] shaking the nulls
Date: Wed, 21 Sep 2005 02:21:48 +0800

Version: 1.15.1-2

Maybe you want to emphasize that one needs -cf real.file more
prominently in the docs, otherwise some users might encounter nulls
frustration:

In Info 9.4.2 The Blocking Factor of an Archive
please say right up front:
  "If you use -f some.real.file then there will be no blocking factor
  used, i.e., no nulls stuck on the back of your file.

  If you use -f -, or no -f, then the following blocking factor section
  will apply."

OK, maybe you do say it already:

     If the output goes directly to a local disk, and not through
     stdout, then the last write is not extended to a full record
     size. Otherwise, reblocking occurs.

Otherwise users will think: ------------------------

Hark, the smallest tar I can now make is 10240 bytes!
$ tar vvc motd|wc -c
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
10240
$ tar zvvc motd|wc -c
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
10240

Wait, smaller:
$ tar vvcb 1 motd|wc -c
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
2048

$ tar zvvcb 1 motd|wc -c
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
512

I recall back in the old days the default was not to add stuff at the
end.

Wait, here I manage to make a smaller tarfile if I start out with a
bigger source file!:

$ cd .. && tar zvvcf
/home/jidanni/jidanni.org/comp/debian/apt-offline/apt-offline.tar.gz \
apt-offline/Makefile && ls -og \
~/jidanni.org/comp/debian/apt-offline/apt-offline.tar.gz
-rw-r--r-- jidanni/jidanni 21186 2005-09-07 06:26:39 apt-offline/Makefile
-rw-r--r--  1 9350 2005-09-21 02:10
/home/jidanni/jidanni.org/comp/debian/apt-offline/apt-offline.tar.gz

With the tiny motd file, I ended up with a bigger tarfile!

I tested for difference if the file was owned by root or not and that
wasn't the problem.

And look at this, when I employ -f, the -vv stuff now goes to stdout
instead of stderr!:

$ tar vvc motd|wc -c
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
10240
$ tar vvcf /tmp/ff motd|wc -c
56

P.S., Info says:

To find out the blocking factor of an existing archive, use `tar
--list --file=ARCHIVE-NAME'. This may not work on some devices.

$ tar --list --file=/tmp/ff
motd

No blocking factor information seen.

Wait, back to our problem,
$ k=/tmp/k;cd /etc;tar vzvcf $k motd|wc -c $k
374 /tmp/k
$ k=/tmp/k;cd /etc;tar vzvcf - motd|wc -c -
-rw-r--r-- root/root       360 2005-09-20 23:31:59 motd
10240 -

OK, apparently one must use -f some.file and not -f -, to get rid of
the nulls.

$ k=/tmp/k;cd /etc;tar vzvcf /dev/stdout motd|wc -c -
10296 -

Alright, and the idea is that otherwise it thinks we are writing to a
tape. OK...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]