Hacker News | 📄 原文链接 | 2026-11-11 收录

最难解的 tar 包:一条命令生成,八种工具解出八种结果

来源:stoppels.ch — 2026-11-07

📋 概述

作者用一次 GNU tar 调用造出一个「最难」的归档:把同名文件重复归档制造硬链接,用 pax 扩展头给硬链接塞进 size=512 覆盖默认的 0,再借重命名把路径变成 UTF-8 的 café。结果同一个 tar 包在 GNU tar、bsdtar、7-Zip、node-tar、Java Commons Compress、PHP PharData、RubyGems 与 R 里被解成八种不同的文件树,有的多出空目录,有的把 tar 头当成文件内容写进去。

🔑 核心要点

💡 金句

an archive that can be constructed using a single GNU tar invocation, that is extracted in 8 distinct ways depending on what tool you use.
← 返回 Hacker News 首页