This link 拥有的信息比我在网上找到的任何其他信息都多。即使是 zip 源也没有任何内容。为后代复制相关部分。这个补丁并不是真的要记录这种格式,它只是显示当前文档是多么可悲(读不存在)。
# external_attr is 4 bytes in size. The high order two
# bytes represent UNIX permission and file type bits,
# while the low order two contain MS-DOS FAT file
# attributes, most notably bit 4 marking directories.
if node.isfile:
zipinfo.compress_type = ZIP_DEFLATED
zipinfo.external_attr = 0644 << 16L # permissions -r-wr--r--
data = node.get_content().read()
properties = node.get_properties()
if 'svn:special' in properties and \
data.startswith('link '):
data = data[5:]
zipinfo.external_attr |= 0120000 << 16L # symlink file type
zipinfo.compress_type = ZIP_STORED
if 'svn:executable' in properties:
zipinfo.external_attr |= 0755 << 16L # -rwxr-xr-x
zipfile.writestr(zipinfo, data)
elif node.isdir and path:
if not zipinfo.filename.endswith('/'):
zipinfo.filename += '/'
zipinfo.compress_type = ZIP_STORED
zipinfo.external_attr = 040755 << 16L # permissions drwxr-xr-x
zipinfo.external_attr |= 0x10 # MS-DOS directory flag
zipfile.writestr(zipinfo, '')
另外,this link 有以下内容。
这里的低位字节大概是指四个字节中最右边(最低)的字节。所以这个是
对于 MS-DOS,否则可能会保留为零。
外部文件属性:(4字节)
The mapping of the external attributes is
host-system dependent (see 'version made by'). For
MS-DOS, the low order byte is the MS-DOS directory
attribute byte. If input came from standard input, this
field is set to zero.
另外,从Debian's archives下载的InfoZIP的zip程序源中的源文件unix/unix.c在cmets中有以下内容。
/* lower-middle external-attribute byte (unused until now):
* high bit => (have GMT mod/acc times) >>> NO LONGER USED! <<<
* second-high bit => have Unix UID/GID info
* NOTE: The high bit was NEVER used in any official Info-ZIP release,
* but its future use should be avoided (if possible), since it
* was used as "GMT mod/acc times local extra field" flags in Zip beta
* versions 2.0j up to 2.0v, for about 1.5 years.
*/
综上所述,看起来实际上只使用了第二高字节,至少对于 Unix 来说是这样。
编辑:我在问题“The zip format's external file attribute”中询问了 Unix.SX 上这方面的 Unix 方面。看起来我有几件事错了。特别是前两个字节都用于 Unix。