Support byte for byte identical compression - #361
Merged
Merged
Conversation
Identical input data should produce identical output date.
mattviasat
commented
Aug 27, 2026
| # --no-name: omit the filename/timestamp from the gzip member | ||
| # header. Without it, the compressed output differ on every run even | ||
| # when the input is byte-for-byte identical. | ||
| GZIP_CMD="gzip --no-name -c$COMPRESS_LEVEL" |
Contributor
Author
There was a problem hiding this comment.
We can enable this test when we are using GNU tar now.
Mac /opt/homebrew/bin/gtar
bash datetest -- testByteforbyte # /opt/homebrew/bin/gtar
testByteforbyte
Header is 772 lines long
About to compress 4 KB of data...
Adding files to archive named "src.sh"...
/opt/homebrew/bin/gtar: Option --mtime: Treating date '20160303' as 2016-03-03 00:00:00
./startup.sh
CRC: 1520247960
MD5: 21a99f115e4b3125a76fef4d4d203432
Self-extractable archive "src.sh" successfully created.
Header is 772 lines long
About to compress 4 KB of data...
Adding files to archive named "src.sh"...
/opt/homebrew/bin/gtar: Option --mtime: Treating date '20160303' as 2016-03-03 00:00:00
./startup.sh
CRC: 1520247960
MD5: 21a99f115e4b3125a76fef4d4d203432
Self-extractable archive "src.sh" successfully created.
Ran 1 test.
OK
It still does not work on bsdtar.
Mac /usr/bin/bsdtar
bash datetest -- testByteforbyte
testByteforbyte
Header is 772 lines long
About to compress 4 KB of data...
Adding files to archive named "src.sh"...
bsdtar: Option --mtime is not supported
Usage:
List: bsdtar -tf <archive-filename>
Extract: bsdtar -xf <archive-filename>
Create: bsdtar -cf <archive-filename> [filenames...]
Help: bsdtar --help
ERROR: failed to create temporary archive: /var/folders/2x/mv56x8w15pb0lv1ql29c99lm0000gp/T//mkself69625.tar
mv: rename src.sh to first: No such file or directory
Header is 772 lines long
About to compress 4 KB of data...
Adding files to archive named "src.sh"...
bsdtar: Option --mtime is not supported
Usage:
List: bsdtar -tf <archive-filename>
Extract: bsdtar -xf <archive-filename>
Create: bsdtar -cf <archive-filename> [filenames...]
Help: bsdtar --help
ERROR: failed to create temporary archive: /var/folders/2x/mv56x8w15pb0lv1ql29c99lm0000gp/T//mkself69649.tar
mv: rename src.sh to second: No such file or directory
cmp: first: No such file or directory
ASSERT:expected:<2> but was:<0>
shunit2:ERROR testByteforbyte() returned non-zero return code.
Ran 1 test.
FAILED (failures=1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GZIP_CMDnow passes--no-nameto gzip, so it stops embedding a fresh timestamp in the compressed archive's header on every packaging run.With this change, we will always see the same output if we receive the same input. This helps when diffing the output of makeself.