I'm using GNU tar
(v1.29) to create an archive and xxd
to inspect it like this:
(
cd "$(mktemp -d)"
touch -d@0 1.txt 2.txt 3.txt
tar \
--format=pax \
--numeric-owner \
--owner=0 \
--group=0 \
--pax-option="exthdr.name=%d/PaxHeaders.0/%f,delete=atime,delete=ctime" \
--mtime=@0 \
-cf ../123.tar \
1.txt 2.txt 3.txt
xxd ../123.tar | grep -C1 ustar
rm -rf $PWD
)
Which gives me this:
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000100: 0075 7374 6172 0030 3000 0000 0000 0000 .ustar.00.......
00000110: 0000 0000 0000 0000 0000 0000 0000 0000 ................
--
000002f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000300: 0075 7374 6172 0030 3000 0000 0000 0000 .ustar.00.......
00000310: 0000 0000 0000 0000 0000 0000 0000 0000 ................
--
000004f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000500: 0075 7374 6172 0030 3000 0000 0000 0000 .ustar.00.......
00000510: 0000 0000 0000 0000 0000 0000 0000 0000 ................
Why does tar --format=pax
produce an archive with ustar
in it?
A pax archive tape or file produced in the -x pax format shall contain a series of blocks. The physical layout of the archive shall be identical to the ustar format described in ustar Interchange Format.
"ustar" followed by 1 zero/NUL byte is the value of the magic
field indicating the type of the archive:
The
magic
field is the specification that this archive was output in this archive format. If this field contains ustar (the five characters from the ISO/IEC 646:1991 standard IRV shown followed by NUL), …
Of course, that's only for any conforming pax
utility, but I'd expect pax
format archives created by GNU tar
to create archives in the same way as a conforming pax
implementation.