8000 release.sh: make sure GNU gzip is used by starius · Pull Request #10268 · lightningnetwork/lnd · GitHub
[go: up one dir, main page]

Skip to content

Conversation

starius
Copy link
Collaborator
@starius starius commented Oct 4, 2025

Change Description

On macOS, the default BSD gzip produces different output than the GNU gzip used on Linux. To ensure reproducible builds, we need to enforce the use of GNU gzip.

This is similar to what we already do for GNU tar.

While working on reproducible builds for Loop, I encountered this gzip issue and fixed it there. This PR applies the same fix to LND.

Steps to Test

Clone my branch into a fresh Git repository to ensure the state is clean and tagged with v0.0.1-test. Build it and compare the resulting hashes against the ones listed below:

$ git clone https://github.com/starius/lnd -b release-gnu-gzip
$ cd lnd
$ SKIP_VERSION_CHECK=1 make release sys="linux-arm64" tag=v0.0.1-test
5ec1abf5d2aa150cce7432a432977a7db99fdf2077431e09600cabe25c16a040  lnd-linux-arm64-v0.0.1-test.tar.gz
501bb50d83a69c7be37e516cc532821196051263d1193aaed4ab6d9c16a349e7  lnd-linux-arm64-v0.0.1-test/lncli
add47fa88e47f997ad52df5c2edb3b00198a4d303105b17075b2b7d8fd96019d  lnd-linux-arm64-v0.0.1-test/lnd
913776165bdeff65ac941f101e4928ac004d39da78ce62c026c98b0d2e4ffb3c  lnd-source-v0.0.1-test.tar.gz
3a914dc298f1441a3432118b8674908def8e52f87092863d14a227e0f5f9d80d  vendor.tar.gz

If you are on macOS, this verification is especially valuable, since this PR fixes reproducibility issues caused by BSD gzip compression on macOS.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

Copy link

Summary of Changes

Hello @starius, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to enhance the reproducibility of LND's release builds by standardizing the gzip utility used during the packaging process. It specifically targets inconsistencies between macOS's default BSD gzip and the GNU gzip commonly found on Linux, ensuring that the compressed output is identical regardless of the build environment. This change is crucial for maintaining consistent build hashes and improving overall build reliability.

Highlights

  • Reproducible Builds: Ensures that release builds are reproducible across different operating systems by enforcing the use of GNU gzip, similar to how GNU tar is already handled.
  • macOS Compatibility: Addresses the issue where the default BSD gzip on macOS produces different output compared to GNU gzip on Linux, which can lead to non-reproducible build artifacts.
  • Gzip Enforcement Logic: Adds logic to the release.sh script to check if the system's gzip is GNU. If not, it attempts to use ggzip (GNU gzip installed via Homebrew) and provides an error message with installation instructions if ggzip is not found.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to ensure reproducible builds by enforcing the use of GNU gzip. The approach is sound and consistent with how GNU tar is handled. However, I found a critical issue where the new logic is not applied because the gzip command is still hardcoded in one place. My review includes a comment detailing the problem and how to fix it.

On MacOS, the default BSD gzip produces a different output than the GNU gzip
on Linux. To ensure reproducible builds, we need to use GNU gzip.

This is similar to what we do to enforce GNU tar.
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.

1 participant
0