[PATCH 1/2] Correct section about PAX headers.
Manuel Jacob
me at manueljacob.de
Thu Apr 16 20:37:13 UTC 2026
The pax format is not the default on all distributions. E.g. openSUSE defaults to the POSIX 1003.1-2001 (pax) format, while Debian, Ubuntu, Fedora and Arch Linux default to the GNU format.
The "ctime" and "atime" headers are added if the pax format is set [1], regardless of the POSIXLY_CORRECT environment variable. Therefore, unsetting POSIXLY_CORRECT is not sufficient for reproducibility.
I think it does not really make sense to suggest to unset POSIXLY_CORRECT. If it’s set and the pax format is used, the current GNU tar version makes two changes: the tar PID is included by default in the file extended header names and global extended header name. The former is overwritten by the suggested `--pax-option` (which is anyway necessary for reproducibility with the pax format). The latter is only output in specific circumstances, such as adding tar file comments. The previous text didn’t mention that and I think that should be kept.
[1] https://cgit.git.savannah.gnu.org/cgit/tar.git/tree/src/create.c?id=d479b2cc9160d9c2fb61afbc9ee70c2faadf80db#n868
---
_docs/archives.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/_docs/archives.md b/_docs/archives.md
index 3640a8cd..04385390 100644
--- a/_docs/archives.md
+++ b/_docs/archives.md
@@ -104,10 +104,9 @@ $ tar --owner=0 --group=0 --numeric-owner -cf product.tar build
PAX headers
-----------
-GNU tar defaults to the pax format and if `POSIXLY_CORRECT` is set, that adds files' ctime, atime and the PID of the tar process as non-deterministic metadata.
+If GNU tar outputs the pax format (which is the default on some distributions), it adds files' ctime and atime. If, in addition, `POSIXLY_CORRECT` is set, it adds the PID of the tar process.
-To avoid this, either `unset POSIXLY_CORRECT` (only works with [tar>1.32](https://git.savannah.gnu.org/cgit/tar.git/commit/?id=ef0f882382f6)) or add to the tar call
-`--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime` or `--format=gnu` (both only available in GNU tar)
+To avoid this, add to the tar call `--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime` or `--format=gnu` (both only available in GNU tar),
or use `--format=ustar` if the limitations in that format are not a problem.
File permissions
--
2.53.0
More information about the rb-general
mailing list