Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#58309 closed defect (fixed)

NOP port upgrade outdated returns error status

Reported by: fhgwright (Fred Wright) Owned by: Kurt Hindenburg <kurt.hindenburg@…>
Priority: Normal Milestone: MacPorts 2.6.0
Component: base Version: 2.5.4
Keywords: Cc: kurthindenburg (Kurt Hindenburg)
Port:

Description

When a "port upgrade outdated" has nothing to do, it returns a nonzero exit status, even though it should be considered a success. If the implied rev-upgrade fails, that could be considered an error, but that shouldn't be relevant if it's suppressed.

In general, one would think that applying a command to an empty pseudoport should be considered a success, though there might be exceptions.

Change History (5)

comment:1 Changed 5 years ago by kurthindenburg (Kurt Hindenburg)

Cc: kurthindenburg added

e05bba0f867a9ef88d80a97678a34c6a1bf0a3ce in 2013 added that - not really sure it would be considered an error that there isn't any ports to upgrade

            ui_msg "Nothing to upgrade."
            return 1

comment:2 Changed 5 years ago by fhgwright (Fred Wright)

It looks like that change made the message not be an error without fixing the exit status.

comment:3 Changed 5 years ago by Kurt Hindenburg <kurt.hindenburg@…>

Owner: set to Kurt Hindenburg <kurt.hindenburg@…>
Resolution: fixed
Status: newclosed

In db19f813b19e23a858d7b3a71584bbce6c8a399b/macports-base (master):

Do not return an error if there's no ports to upgrade

e05bba0f867a9ef88d80a97678a34c6a1bf0a3ce added a "Nothing to upgrade"
message when doing a 'port upgrade outdated' and returned an error.
This changes the return value to a non error.

closes #58309

comment:4 Changed 5 years ago by fhgwright (Fred Wright)

That looks like this change should fix the immediate problem, although the earlier "fix" was pretty ugly. The code for getting the port list is directly treating the empty result as an error, except for a special-case check for whether it was called from "upgrade". It would be far cleaner if it simply returned the result without complaining. leaving it up to the caller to decide whether an empty list is acceptable. If that would require fixing too many places to call out the error, then there could be a wrapper function with the fail-on-empty check, with "upgrade" not using the wrapper.

comment:5 Changed 5 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.6.0
Note: See TracTickets for help on using tickets.