我不清楚什么是正确的.tar
文件格式,因为我在三种情况下遇到了正确的功能(见下文)。
根据.tar
我一直在使用的规范,magic
字段 (ustar) 是以空字符结尾的字符串,version
字段是八进制数,没有尾随空字符。
但是,我查看了.tar
在我的服务器上找到的几个文件,发现magic
andversion
字段的不同实现,它们三个似乎都可以正常工作,可能是因为系统忽略了这些字段。
在以下示例中查看单词ustar和root之间的不同 (3) 个字节>>
情景 1 ( 20 20 00
):
000000F0 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
000000FC 00 00 00 00 | 00 75 73 74 | 61 72 20 20 .....ustar
00000108 00 72 6F 6F | 74 00 00 00 | 00 00 00 00 .root.......
00000114 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
情景 2 ( 00 20 20
):
000000F0 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
000000FC 00 00 00 00 | 00 75 73 74 | 61 72 00 20 .....ustar.
00000108 20 72 6F 6F | 74 00 00 00 | 00 00 00 00 root.......
00000114 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
情景 3 ( 00 00 00
):
000000F0 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
000000FC 00 00 00 00 | 00 75 73 74 | 61 72 00 00 .....ustar..
00000108 00 72 6F 6F | 74 00 00 00 | 00 00 00 00 .root.......
00000114 00 00 00 00 | 00 00 00 00 | 00 00 00 00 ............
哪一个是正确的格式?