该链接比我在网上可以找到的任何其他信息都要多。 甚至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, '')
另外,此链接包含以下内容。这里的低位字节大概是指四个字节中最右边(最低)的字节。 所以这个是对于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的档案中下载的InfoZIP zip程序的源文件中的unix / unix.c源文件在注释中具有以下内容。
/* 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中,实际上似乎只使用了第二个最高字节。
编辑:我在“ zip格式的外部文件属性”问题中询问了Unix.SX的Unix方面。 看来我做错了两件事。 具体来说,前两个字节都用于Unix。