I think I've found a very serious bug in gtar 1.17 and I'm reporting it because the following web page mentions gtar 1.17 as good for current Amandas.


[email protected]:test> /usr/sfw/bin/gtar --version
tar (GNU tar) 1.17
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

[email protected]:test> uname -a
SunOS azati 5.10 Generic_141445-09 i86pc i386 i86pc

The problem is that archives created with gtar 1.17 from a ZFS filesystem with activated compression contain broken content. But the archive itself is correct and therefore Amanda doesn't notice that.

I've copied the same file to two ZFS filesystems.

[email protected]:test> ls -la /a0/test/a0/file /a0/test/a1/file
-rw-r--r-- 1 amanda amanda 4499578880 Jul 24 17:17 /a0/test/a0/file
-rw-r--r-- 1 amanda amanda 4499578880 Jul 24 17:17 /a0/test/a1/file

The file is identical.

[email protected]:test> cmp /a0/test/a0/file /a0/test/a1/file
[email protected]:test> echo $?

But the one in /a0/test/a1 is comrpessed with ZFS compression.

[email protected]:test> du -k /a0/test/a0/file /a0/test/a1/file
4397508 /a0/test/a0/file
3905079 /a0/test/a1/file

[email protected]:test> df -h /a0/test/a0/file /a0/test/a1/file
Filesystem size used avail capacity Mounted on
a0/test/a0 3.6T 4.2G 694G 1% /a0/test/a0
a0/test/a1 3.6T 3.7G 694G 1% /a0/test/a1

[email protected]:test> zfs get compression,compressratio a0/test/a0
a0/test/a0 compression off default
a0/test/a0 compressratio 1.00x -
[email protected]:test> zfs get compression,compressratio a0/test/a1
a0/test/a1 compression on local
a0/test/a1 compressratio 1.12x -

Creating a tar archive, with the arguments used by Amanda, from the uncompressed ZFS filesystem works as expected.

[email protected]:test> /usr/sfw/bin/gtar --create --file - --directory /a0/test/a0 --one-file-system --sparse --ignore-failed-read --totals --exclude-from /dev/null . > a0.gtar
Total bytes written: 4499589120 (4.2GiB, 108MiB/s)
[email protected]:test> /usr/sfw/bin/gtar xvf a0.gtar
[email protected]:test> cmp file /a0/test/a0/file
[email protected]:test> cmp file /a0/test/a1/file

But from the compressed ZFS filesystem it doesn't.

[email protected]:test> /usr/sfw/bin/gtar --create --file - --directory /a0/test/a1 --one-file-system --sparse --ignore-failed-read --totals --exclude-from /dev/null . a1.gtar
Total bytes written: 4499578880 (4.2GiB, 103MiB/s)
[email protected]:test> /usr/sfw/bin/gtar xvf a1.gtar
[email protected]:test> cmp file /a0/test/a0/file
file /a0/test/a0/file differ: char 1, line 1
[email protected]:test> cmp file /a0/test/a1/file
file /a0/test/a1/file differ: char 1, line 1

I cannot reproduce this issue with gtar 1.26.