惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
Vercel News
Vercel News
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
量子位
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
IT之家
IT之家
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)

暗无天日

读:AI Agent 安全日志——从可见性与隐私的两难说起 - 暗无天日 读:AI Agent 生产化——一份从原型到上线的速查清单 - 暗无天日 AI写作的语言指纹——如何让文字不那么像机器 - 暗无天日 读:50 条 Claude Code 技巧——一个工程经理的六个月使用心得 读:AI 辅助开发为什么让 E2E 测试更有价值 - 暗无天日 读:在Emacs中使用Claude Code(Spacemacs适配版) - 暗无天日 Claude Code 背后的工程哲学——读 Agent Harness Engineering 读:Agent Harness Engineering——AI 智能体不只是模型,还有套件 - 暗无天日 browser-harness:让 AI 直接接管你的浏览器 - 暗无天日 读:Security-First CI/CD —— DevSecOps 自动化实践指南 TIL: 数字小键盘的小数点陷阱与行内算术求值 - 暗无天日 读:Immutability 不是万能药,它是一种权衡 - 暗无天日 Conducty:给 Claude Code 加上项目记忆和并行执行能力 - 暗无天日 读 — GitHub Trending 里的 Claude Code 技能包 读 — Prompt Caching 省钱指南 TIL: Emacs 中那些跟鼠标配合的冷门快捷键 - 暗无天日 读:Anvil——把 Emacs 变成 AI 的工具服务器 读:Emacs 代码折叠终极指南 - 暗无天日 读:Clojure 搭车客指南 - 暗无天日 git推送失败后恢复仓库损坏的完整记录 - 暗无天日 多智能体系统的两个有效模式——以及对 Claude Code 用户的启示 - 暗无天日 用 Org Babel 写 Literate 博文:扩展执行 + 定制导出 proced:Emacs 内置的进程查看器 - 暗无天日 从 proced 定制中学到的 Elisp 模式 读:让 Emacs proced 在 macOS 上显示 CPU 和内存 异步编程的函数着色税 - 暗无天日 链式调用的代价:JavaScript 和 Clojure 的共同教训 - 暗无天日 hyperfine:命令行基准测试工具 - 暗无天日 管道中的变量去哪了?——子 shell 作用域陷阱 - 暗无天日 开源包装器的信任陷阱:四个危险信号 - 暗无天日
创建跨平台 ZIP 文件的隐藏陷阱:Extra Field - 暗无天日
lujun9972 · 2026-04-15 · via 暗无天日

我们可以用 zipinfo 命令直观地看到有无 Extra Field 的区别。先创建一个测试目录:

mkdir -p /tmp/zip-test/demo
echo "hello world" > /tmp/zip-test/demo/hello.txt
chmod 755 /tmp/zip-test/demo/hello.txt

分别用默认方式和 -X 选项打包:

cd /tmp/zip-test
zip -r with-extra.zip demo/
zip -rX without-extra.zip demo/
adding: demo/ (stored 0%)
adding: demo/hello.txt (stored 0%)
adding: demo/ (stored 0%)
adding: demo/hello.txt (stored 0%)

zipinfo 查看包含 Extra Field 的版本:

zipinfo /tmp/zip-test/with-extra.zip
Archive:  /tmp/zip-test/with-extra.zip
Zip file size: 328 bytes, number of entries: 2
drwxr-xr-x  3.0 unx        0 bx stor 26-Apr-15 23:01 demo/
-rwxr-xr-x  3.0 unx       12 tx stor 26-Apr-15 23:01 demo/hello.txt
2 files, 12 bytes uncompressed, 12 bytes compressed:  0.0%

注意输出中的 unxbx / txunx 表示 Unix 格式的条目, bx / tx 中的 x 表示文件保留了可执行权限。

再看不含 Extra Field 的版本:

zipinfo /tmp/zip-test/without-extra.zip
Archive:  /tmp/zip-test/without-extra.zip
Zip file size: 224 bytes, number of entries: 2
drwxr-xr-x  3.0 unx        0 b- stor 26-Apr-15 23:01 demo/
-rwxr-xr-x  3.0 unx       12 t- stor 26-Apr-15 23:01 demo/hello.txt
2 files, 12 bytes uncompressed, 12 bytes compressed:  0.0%

zipinfo -v 可以看到更详细的差异:

zipinfo -v /tmp/zip-test/with-extra.zip | grep -E "(length of extra field|central-directory extra field|subfield with ID)"
length of extra field:                          24 bytes
The central-directory extra field contains:
- A subfield with ID 0x5455 (universal time) and 5 data bytes.
- A subfield with ID 0x7875 (Unix UID/GID (any size)) and 11 data bytes:
length of extra field:                          24 bytes
The central-directory extra field contains:
- A subfield with ID 0x5455 (universal time) and 5 data bytes.
- A subfield with ID 0x7875 (Unix UID/GID (any size)) and 11 data bytes:

对比不含 Extra Field 的版本:

zipinfo -v /tmp/zip-test/without-extra.zip | grep "extra field"
length of extra field:                          0 bytes
length of extra field:                          0 bytes

文件大小的差异也很明显:328 bytes vs 224 bytes,差了 104 bytes,正好是两个条目各 24 bytes 的 Extra Field(包含 Universal Time 和 Unix UID/GID)加上头部开销。