Skip to content

Commit

Permalink
Reproducible Builds: Do not store timestamps in gzip header (#3096)
Browse files Browse the repository at this point in the history
When trying to reproduce the binary package from source on [reproducible.archlinux.org](https://reproducible.archlinux.org/) we noticed the man pages record the current time, causing a mismatch:

```
--- /tmp/rebuilderdInk8BR/inputs/bpftrace-0.20.3-1-x86_64.pkg.tar.zst
    /tmp/rebuilderdInk8BR/out/bpftrace-0.20.3-1-x86_64.pkg.tar.zst
├── bpftrace-0.20.3-1-x86_64.pkg.tar
│ ├── .MTREE
│ │ ├── .MTREE-content
│ │ │ @@ -96,15  96,15 @@
│ │ │  ./usr/share/man time=1711510112.0 mode=755 type=dir
│ │ │  ./usr/share/man/man8 time=1711510112.0 mode=755 type=dir
│ │ │  ./usr/share/man/man8/bashreadline.bt.8.gz time=1711510112.0 size=771 sha256digest=a6755205892df70430168305067df14278219769a9afa4ba79dbaab5f76b3741
│ │ │  ./usr/share/man/man8/biolatency.bt.8.gz time=1711510112.0 size=1091 sha256digest=785de0d46eebf4c5bec10772de135b027aa7b34831e6823c09b817ec605d50c0
│ │ │  ./usr/share/man/man8/biosnoop.bt.8.gz time=1711510112.0 size=970 sha256digest=2e1d8d039a5e3a9c04f34575f2286a0fe66c59f92ad13e610939c0b6bc67cb49
│ │ │  ./usr/share/man/man8/biostacks.bt.8.gz time=1711510112.0 size=1091 sha256digest=e917f8fe907c0f1463f58e55b39ac55977214fff04faa20c700c84e763e8d05c
│ │ │  ./usr/share/man/man8/bitesize.bt.8.gz time=1711510112.0 size=862 sha256digest=fe9b9eb34f1b9f77fa7ff519a4b535ad951ca0929496eaf754fba8c46c90b707
│ │ │ -./usr/share/man/man8/bpftrace.8.gz time=1711510112.0 size=24699 sha256digest=d42120da7b61ec927d74de80c275146c32fb8fa9004a910811f8088b4bdabb97
│ │ │  ./usr/share/man/man8/bpftrace.8.gz time=1711510112.0 size=24699 sha256digest=a9cbf0fc1ed14ee922828323aca662d829e1dbf43e2a9bc42e11c8c2dadc0b4f
│ │ │  ./usr/share/man/man8/capable.bt.8.gz time=1711510112.0 size=821 sha256digest=9c8af79b2a6e8cdb2548c84be12a50518409af27216faaa0bfab3b33d1c401c6
│ │ │  ./usr/share/man/man8/cpuwalk.bt.8.gz time=1711510112.0 size=754 sha256digest=d47b9d9e0c54d5eec3e541d4514aec8413bbc92f2e7174f0aa87b246443c0bec
│ │ │  ./usr/share/man/man8/dcsnoop.bt.8.gz time=1711510112.0 size=1110 sha256digest=391d73dab99f8ea6dfe80a24914c148b299d5e6e6c52ed1867e9cf915af8a679
│ │ │  ./usr/share/man/man8/execsnoop.bt.8.gz time=1711510112.0 size=1036 sha256digest=8c4b84d4d36d95b67d9649a456518823451751f2d7f0c0b743ed787fc84f9910
│ │ │  ./usr/share/man/man8/gethostlatency.bt.8.gz time=1711510112.0 size=938 sha256digest=74d33fc1aac56a1f462e1b4a576c32d2ac767be5adda2c1ab41e5a264b32a763
│ │ │  ./usr/share/man/man8/killsnoop.bt.8.gz time=1711510112.0 size=909 sha256digest=4861a81e58e396bc56a6f1a3e78173ab104a28a6c6549a7e1bf7119a2cc23569
│ │ │  ./usr/share/man/man8/loads.bt.8.gz time=1711510112.0 size=1102 sha256digest=aecbb1d61177de9deca7bb4e59e753831069c6589cf1e4905f5f1f7976d29c00
│ ├── usr/share/man/man8/bpftrace.8.gz
│ │ ├── filetype from file(1)
│ │ │ @@ -1  1 @@
│ │ │ -gzip compressed data, was "bpftrace.8", last modified: Wed Mar 27 03:29:32 2024, from Unix
│ │ │  gzip compressed data, was "bpftrace.8", last modified: Wed Mar 27 03:37:03 2024, from Unix
```

Using the `gzip -n` switch disables this feature, making the man pages reproducible.
  • Loading branch information
kpcyrd authored Apr 1, 2024
1 parent cf40415 commit 483b038
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 24,8 @@ and this project adheres to
#### Changed
- Better error message for args in mixed probes
- [#3047](https://github.com/bpftrace/bpftrace/pull/3047)
- Reproducible Builds: Do not store timestamps in gzip header
- [#3096](https://github.com/bpftrace/bpftrace/pull/3096)
#### Deprecated
#### Removed
#### Fixed
Expand Down
2 changes: 1 addition & 1 deletion man/adoc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,7 @@ if(NOT "${ASCIIDOCTOR}" STREQUAL "ASCIIDOCTOR-NOTFOUND")
DEPENDS ${FIL})

add_custom_command(OUTPUT ${GZ_MANPAGE_FILE}
COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE}
COMMAND ${GZIP} -nc ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE}
DEPENDS ${MANPAGE_FILE})

list(APPEND GZFILES ${GZ_MANPAGE_FILE})
Expand Down
2 changes: 1 addition & 1 deletion man/man8/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@ set(GZFILES "")
foreach(FIL ${FILES})
get_filename_component(NAME ${FIL} NAME)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
COMMAND ${GZIP} -nc ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz
DEPENDS ${FIL})
list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz")
endforeach()
Expand Down
4 changes: 2 additions & 2 deletions scripts/create-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 47,8 @@ tar --xz -cf "$OUT/tools.tar.xz" -C "$TMP/bin" "."
info "Creating man archive"
mkdir -p "$TMP/share/man/man8"
cp man/man8/*.8 "$TMP/share//man/man8/"
gzip "$TMP/share/man/man8/"*
asciidoctor man/adoc/bpftrace.adoc -b manpage -o - | gzip - > "$TMP/share/man/man8/bpftrace.8.gz"
gzip -n "$TMP/share/man/man8/"*
asciidoctor man/adoc/bpftrace.adoc -b manpage -o - | gzip -n - > "$TMP/share/man/man8/bpftrace.8.gz"
tar --xz -cf "$OUT/man.tar.xz" -C "$TMP/share" man

info "Building bpftrace appimage"
Expand Down

0 comments on commit 483b038

Please sign in to comment.