为什么 GNU tar --format=pax 生成 ustar 档案?
Why does GNU tar --format=pax produce ustar archives?
我正在使用 GNU tar
(v1.29) 创建存档并 xxd
像这样检查它:
(
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
)
这给了我这个:
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 ................
为什么 tar --format=pax
会生成一个包含 ustar
的存档?
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”后跟 1 个 zero/NUL 字节是 magic
字段的值,指示存档类型:
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), …
当然,这仅适用于任何符合规范的 pax
实用程序,但我希望 GNU tar
创建的 pax
格式档案能够以与符合规范的程序相同的方式创建档案pax
实施。
我正在使用 GNU tar
(v1.29) 创建存档并 xxd
像这样检查它:
(
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
)
这给了我这个:
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 ................
为什么 tar --format=pax
会生成一个包含 ustar
的存档?
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”后跟 1 个 zero/NUL 字节是 magic
字段的值,指示存档类型:
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), …
当然,这仅适用于任何符合规范的 pax
实用程序,但我希望 GNU tar
创建的 pax
格式档案能够以与符合规范的程序相同的方式创建档案pax
实施。