Skip to content

Support byte for byte identical compression - #361

Merged
megastep merged 2 commits into
megastep:masterfrom
mattviasat:byte-identical-output
Aug 27, 2026
Merged

megastep merged 2 commits into
megastep:masterfrom
mattviasat:byte-identical-output

Conversation

@mattviasat

Copy link
Copy Markdown
Contributor

GZIP_CMD now passes --no-name to 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.

Identical input data should produce identical output date.
Comment thread makeself.sh
# --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"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@mattviasat
mattviasat marked this pull request as ready for review August 27, 2026 18:21
@megastep megastep self-assigned this Aug 27, 2026

@megastep megastep left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@megastep
megastep merged commit 4c1e2d4 into megastep:master Aug 27, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants