Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: Ensure that projects are rebuild if upstream decides to retag #34779

Closed
leonklingele opened this issue Dec 4, 2018 · 7 comments
Closed
Labels
checksum mismatch SHA-256 doesn't match the download maintainer feedback Additional maintainers' opinions may be needed

Comments

@leonklingele
Copy link
Contributor

leonklingele commented Dec 4, 2018

Retags, unfortunately, are a thing and happen from time to time.
For those unaware of the issue: Tags of projects tracked by Homebrew sometimes are pushed to their upstream repository, removed shortly after, and are then re-pushed in a slightly different form (e.g. to include supposedly important fixes). Most likely a lot of those "emergency" retags go without notice, yet it happens that Homebrew maintainers are quick enough to spot the initial tag, issuing a new "Homebrew release" of that project. As Homebrew formulae include the checksum of the project's release tarball and this checksum changes after a retag, installations from source via Homebrew will yield a checksum mismatch error. The checksum of those formula will eventually be fixed, making source-builds succeed again.

It so happens that Homebrew end users can be quick enough to build the initial release tag (by running brew upgrade before the retag was issued). Those users will continue to use a build made using the outdated release if no revision bump was made. Revisions of Homebrew formulae are only issued if the retag appears to be changed in a significant way (e.g. if changes to the source code are made). Yet source code changes are not the only reason why a rebuild might be required.

Take #25845 as an example where libjpeg retagged their most recent v9c release, apparently only removing a seemingly unimportant, empty file (jpeg-9c/.directory) which couldn't possibly result in a different build, therefore an increase of revision was not made. Well, this empty file could actually cause a completely different build if the build process somehow depends on it. How was it verified that this is not the case? Did the libjpeg authors bless the retag? A revision bump is available in #34767.

Here is a list of some other checksum fixes which did not receive a revision bump:

Humans, by their very nature, make mistakes. As it is easy to not rely on humans to decide whether forcing a rebuild is sensible or not and most formulae don't take hours to build, I ask to simply always enforce rebuilds (this includes bottles as well) by revision bumping formulas after any of their included checksums change for whatever reason.

@SMillerDev SMillerDev added maintainer feedback Additional maintainers' opinions may be needed checksum mismatch SHA-256 doesn't match the download labels Dec 4, 2018
@fxcoudert
Copy link
Member

fxcoudert commented Dec 4, 2018

First, retags should not happen in projects following semantic versioning (version numbers should uniquely identify a given state of the source and its distribution). Moreover, when they happen it is because upstream deemed it unnecessary to issue a new release and force all users to update. In other words: a retag is, by its very definition, not a new version but the same version, i.e. the same state of the software.

Our current policy is the following:

  1. The change of checksum with identical version number is treated as suspicious, since it could be malicious (someone took control of the repository or file server, and switched the sources)
  2. Once we confirm that the change in sources is intentional (usually by contacting upstream and asking them), we fix the checksum in Homebrew
  3. The maintainer merging the retag then makes an informed decision about the necessity for pulling new bottles and bumping revision. Pulling new bottles cannot really hurt, but bumping revision has a cost: it will make all users upgrade, i.e. download new bottles or rebuild from source. So:
    • Unless there was something seriously wrong with the previous build, we do not bump the revision number.
    • We do, however, bump the revision number if the previous software was broken in significant way: for example, if the retag is actually a hot fix, because the maintainer realised they shipped a buggy tarball.
  4. We advise all upstream projects to stick to semantic versioning, and rather than retag, change the version number in a minor way to indicate the bug fix, when one is made.

My opinion is that the policy above is close to optimal, as it minimises the discomfort to our users while taking all elements into account before making a decision to bump revision or not.

If this decision was incorrectly made in some cases in the past, this should be fixed and specific pull requests addressing the issue are welcome (including details on what is wrong).

@MikeMcQuaid
Copy link
Member

Agreed with @fxcoudert. Closing but feel free to continue discussion here.

@leonklingele
Copy link
Contributor Author

This just feels wrong to me. A package manager clearly should never — under no circumstance — treat two different releases as being the same, giving a false sense of security. I can guarantee you that this will eventually hit someone sooner or later. Even if there is a negligible probability that there will be any problems due to this, why not choose a way which will not? Sure, rebuilding sucks, but end users shouldn't blame Homebrew for that. It's the software developer who made a mistake.

What do you think of adding support for a new env var, e.g. HOMEBREW_REBUILD_RETAGS, which will enforce software rebuilds on retags? Similar to revision [NUM] there could be a retag [NUM].

And what about the cases I've mentioned in the initial report? What about those 94 formulae?

@SMillerDev
Copy link
Member

The git tarbal issue weren't retags as is stated in the linked issue. A retag is the same release though, 6.0.0 is the exact same as 6.0.0. If we can't trust that to be the case we're better off giving up on versioning altogether and just building the software from the latest upstream locally on install.

@leonklingele
Copy link
Contributor Author

The git tarbal issue weren't retags as is stated in the linked issue.

What makes you so sure about that? Have all the tarballs been checked for diffs? Just because GitHub had some issues which caused different tarballs to be available doesn't mean those projects didn't retag just minutes before / after that. You see, I'm just speculating here. But given that 94 formulae were updated it's not so unlikely that a retag was amongst them.

@SMillerDev
Copy link
Member

Issue #18044 which is referenced in the PR you linked mentions the checks people did to make sure there weren't any retags in there.

@MikeMcQuaid
Copy link
Member

Sure, rebuilding sucks, but end users shouldn't blame Homebrew for that.

Regardless of whether they should or will: it makes the experience of using Homebrew worse for those users for no good reason so we're not going to do it.

What do you think of adding support for a new env var, e.g. HOMEBREW_REBUILD_RETAGS, which will enforce software rebuilds on retags? Similar to revision [NUM] there could be a retag [NUM].

I would want to see many more users (and maintainers for whom the work will fall to keep up with that) asking for something like this before it would be even considered.

What makes you so sure about that?

Because: we're running a package manager, do a lot of work behind that scenes that's not always make public, we have two GitHub employees as maintainers and many other reasons.

I appreciate your contributions to Homebrew but I don't like your tone in this issue. Please address it in future issues to sound less like you are trying to teach people who are successfully running a package manager how to do so. Issues like this based on speculation are not helpful. Contributions to Homebrew are useful and if you contribute enough you may be able to become a maintainer in future and have influence over how the project is run.

@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
checksum mismatch SHA-256 doesn't match the download maintainer feedback Additional maintainers' opinions may be needed
Projects
None yet
Development

No branches or pull requests

4 participants