Tar archive quadratic time. By Martin Dørum. 2022
why tar archive sucks
Amazing article. After 30 years, now i know the unix tar format, and how bad it is.
- Originally allow only 100 chars for file path. If full path is longer than that, it truncates it silently.
- No indexing of files. You need to read the entire archive to know what files are in it.
- Via 3 extensions over decades, UStar, pax file format, gnu tar, the format became very convoluted. quote: “needs to support 5 different ways of reading the file path, 5 different ways of reading the link path, and 3 different ways of reading the file size”
- Gnu tar, in order to prevent security problem of extracting file outside the current dir, do a complicated check, making it super slow.
- But if you use option “tar -P” (or --absolute-paths), it bypass this but mean malicious tar file can put files anywhere on your system.
- The tar archive format, its extensions, and why GNU tar extracts in quadratic time
- By Martin Dørum aka Mortie
- https://mort.coffee/home/tar/