Brew: pinned packages causes brew upgrade to exit 1

Created on 10 Aug 2020  路  2Comments  路  Source: Homebrew/brew

A detailed description of the proposed feature

Hi guys, I've been wondering this for a while now, is it intended pinned packages to cause exit 1 when brew upgrade? doesn't it make more sense to exit 0 and a warning/message for not-to-be-upgraded packages since it's the expected behavior?

The motivation for the feature

Exit 1 might be a bit confusing and break automation that depends on exit codes (sure a workaround expecting non-zero may help, but still)

Thanks in advance for your time and this great tool, and if this issue results irrelevant, feel free to do as you please.

Most helpful comment

doesn't it make more sense to exit 0 and a warning/message for not-to-be-upgraded packages since it's the expected behavior?

I don't think that makes sense, simply because the "expected behavior" is in fact to upgrade. brew upgrade encounters pinned formulae in one of the following circumstances:

  1. brew upgrade <pinned_formula>: You specifically requested to upgrade that formula, but it's pinned -- ERROR
  2. brew upgrade <other_formula>, that depends on <pinned_formula>: <other_formula> is stuck at the old version, because only the latest versions of all formulae are tested against each other -- ERROR
  3. brew upgrade, and some outdated formulae depend on <pinned_formula>: this is a broader case of [2] -- ERROR
  4. brew upgrade, and no outdated formulae depend on <pinned_formula>: this is arguably the only case where a warning could be applied, but it's also often the case that users forget that these formulae are pinned, and therefore haven't been updated with the latest security fixes, so it still makes sense to throw an ERROR that reminds users of this state

Keep in mind that a reported error that's expected by the user can be ignored (in scripts, it may just be a matter of checking the system state or command output), but a dangerously out-of-date software package that doesn't trigger any double-checks (because brew does an exit 0) remains a hidden time-bomb.

But in the cases where ignoring pinned packages is required, there's already a --ignore-pinned option.

All 2 comments

doesn't it make more sense to exit 0 and a warning/message for not-to-be-upgraded packages since it's the expected behavior?

I don't think that makes sense, simply because the "expected behavior" is in fact to upgrade. brew upgrade encounters pinned formulae in one of the following circumstances:

  1. brew upgrade <pinned_formula>: You specifically requested to upgrade that formula, but it's pinned -- ERROR
  2. brew upgrade <other_formula>, that depends on <pinned_formula>: <other_formula> is stuck at the old version, because only the latest versions of all formulae are tested against each other -- ERROR
  3. brew upgrade, and some outdated formulae depend on <pinned_formula>: this is a broader case of [2] -- ERROR
  4. brew upgrade, and no outdated formulae depend on <pinned_formula>: this is arguably the only case where a warning could be applied, but it's also often the case that users forget that these formulae are pinned, and therefore haven't been updated with the latest security fixes, so it still makes sense to throw an ERROR that reminds users of this state

Keep in mind that a reported error that's expected by the user can be ignored (in scripts, it may just be a matter of checking the system state or command output), but a dangerously out-of-date software package that doesn't trigger any double-checks (because brew does an exit 0) remains a hidden time-bomb.

But in the cases where ignoring pinned packages is required, there's already a --ignore-pinned option.

s it intended pinned packages to cause exit 1 when brew upgrade?

Yes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdekok picture cdekok  路  4Comments

rtobrien picture rtobrien  路  3Comments

javian picture javian  路  4Comments

cfredhart picture cfredhart  路  4Comments

MikeMcQuaid picture MikeMcQuaid  路  3Comments