bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] Strange behaviour using stdout and compressed tars


From: Aviv Greenberg
Subject: [Bug-tar] Strange behaviour using stdout and compressed tars
Date: Tue, 07 Sep 2004 19:15:58 -0700

Run the following script:

------------------------------------------

#!/bin/bash


SRC_FOLDER=/etc/httpd

# create 2 regular tar files using 2 methods
tar cf tar-m1.tar ${SRC_FOLDER}
tar cf - ${SRC_FOLDER} > tar-m2.tar

# create 2 gz tar files using 2 methods
tar zcf ztar-m1.tar ${SRC_FOLDER}
tar zcf - ${SRC_FOLDER} > ztar-m2.tar

# create 2 bz tar files using 2 methods
tar jcf jtar-m1.tar ${SRC_FOLDER}
tar jcf - ${SRC_FOLDER} > jtar-m2.tar

------------------------------------------

What i get on my machine is:
-rw-r--r--   1 root root     1421 Sep  7 19:03 jtar-m1.tar
-rw-r--r--   1 root root    10240 Sep  7 19:03 jtar-m2.tar
-rw-r--r--   1 root root    20480 Sep  7 19:03 tar-m1.tar
-rw-r--r--   1 root root    20480 Sep  7 19:03 tar-m2.tar
-rw-r--r--   1 root root     1199 Sep  7 19:03 ztar-m1.tar
-rw-r--r--   1 root root    10240 Sep  7 19:03 ztar-m2.tar

So as you can see, if i use no compression, then going through
stdout gives the same file size as specifing an explicit output file
name.

If i use the z or j flags, then the m1 and m2 files are not the same
size!

I examined the files in xxd, the compressed m2 files have trailing
zeroes for some reason.

The files are not corrupted tough, and they can be untarred with a
"bzip2: (stdin): trailing garbage after EOF ignored"
warning.

Is this the expected behaviour? If not, what can i do to help fix that?

Aviv








reply via email to

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