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

Fix bad livecheck block url symbols #195414

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

samford
Copy link
Member

@samford samford commented Oct 24, 2024

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

The livecheck blocks in this PR use url :url but :url should only be used in casks and this should be url :stable instead.


For what it's worth, I'm creating a RuboCop for this, so bad symbol references should be surfaced in the future. I'm currently working on refactoring the livecheck RuboCop setup, so the cops will also apply to livecheck blocks in resources and casks. It's most of the way done (it works for formulae/resources and most casks) but I have to account for some unusual cask setups before I create a PR.

`:url` is only used in casks and this should be `:stable` in formulae.
`:url` is only used in casks and this should be `:stable` in formulae.
@samford samford added livecheck Issues or PRs related to livecheck CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. labels Oct 24, 2024
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

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

Seems weird that these passed the brew livecheck test run by test-bot anyway.

@BrewTestBot BrewTestBot added this pull request to the merge queue Oct 24, 2024
Merged via the queue into master with commit 5a55278 Oct 24, 2024
17 checks passed
@BrewTestBot BrewTestBot deleted the livecheck/fix-bad-url-symbols branch October 24, 2024 04:08
@samford
Copy link
Member Author

samford commented Oct 24, 2024

Seems weird that these passed the brew livecheck test run by test-bot anyway.

@carlocab livecheck doesn't error if a livecheck block uses a symbol argument that doesn't correspond to a checkable URL. The formulae in this PR are using a cask symbol but this can also occur if a livecheck block uses a symbol for an optional URL like head but the referenced URL is later removed.

When a bad symbol is provided, likecheck ignores it and goes through the checkable URLS in the formula (the default behavior). The stable URL is checked first, so these end up working as expected merely by chance.

It only becomes apparent if the check fails or you use --debug and livecheck has to iterate through more than one checkable URL before reaching one that works. I'll see about adding an error in livecheck to catch this at runtime as well, as it can lead to unexpected behavior.

@carlocab
Copy link
Member

When a bad symbol is provided, likecheck ignores it and goes through the checkable URLS in the formula (the default behavior). The stable URL is checked first, so these end up working as expected merely by chance.

That doesn't seem like the right behaviour.

@samford
Copy link
Member Author

samford commented Oct 24, 2024

That doesn't seem like the right behaviour.

I agree. I should have been clear that it's not intentional behavior and only happens because we forgot to account for this error condition. I'll have a brew PR up once I finish testing (edit: Homebrew/brew#18622).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. livecheck Issues or PRs related to livecheck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants