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?
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.
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:
brew upgrade <pinned_formula>: You specifically requested to upgrade that formula, but it's pinned -- ERRORbrew 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 -- ERRORbrew upgrade, and some outdated formulae depend on <pinned_formula>: this is a broader case of [2] -- ERRORbrew 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 stateKeep 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.
Most helpful comment
I don't think that makes sense, simply because the "expected behavior" is in fact to upgrade.
brew upgradeencounters pinned formulae in one of the following circumstances:brew upgrade <pinned_formula>: You specifically requested to upgrade that formula, but it's pinned -- ERRORbrew 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 -- ERRORbrew upgrade, and some outdated formulae depend on<pinned_formula>: this is a broader case of [2] -- ERRORbrew 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 stateKeep 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
brewdoes anexit 0) remains a hidden time-bomb.But in the cases where ignoring pinned packages is required, there's already a
--ignore-pinnedoption.