Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#56549 closed defect (fixed)

selfupdate loses error message returned by mportsync

Reported by: jmroot (Joshua Root) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version:
Keywords: Cc: Schamschula (Marius Schamschula), siccegge (Christoph Egger)
Port:

Description

% sudo port sync                    
--->  Updating the ports tree
port sync failed: Synchronization of 1 source failed

The last line there is sometimes the only error message generated outside of verbose mode, e.g. when a git repo fails to sync. selfupdate::main does this:

        try {
            mportsync $optionslist
        }  catch {{*} eCode eMessage} {
            return -code error "Couldn't sync the ports tree: $eMessage"
        }

which should return an error message that includes mportsync's. But apparently something further up the call chain fails to print it:

% sudo port selfupdate   
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.5.99 installed,
MacPorts base version 2.5.0 downloaded.
--->  Updating the ports tree

Needless to say, this is pretty confusing.

Change History (5)

comment:1 Changed 6 years ago by jmroot (Joshua Root)

Actually it's worse than that. From action_selfupdate:

    if { [catch {macports::selfupdate [array get options] base_updated} result ] } {
        ui_debug $::errorInfo
        ui_error $result
        if {![macports::ui_isset ports_verbose]} {
            ui_msg "Please run `port -v selfupdate' for details."
        } else {
            # Let's only print the ticket URL if the user has followed the
            # advice we printed earlier.
            print_tickets_url
        }
        fatal "port selfupdate failed: $result"
    }

None of that stuff is being printed, which means macports::selfupdate is appearing to succeed when it in fact failed.

comment:2 Changed 6 years ago by Schamschula (Marius Schamschula)

Cc: Schamschula added

comment:3 Changed 5 years ago by siccegge (Christoph Egger)

Cc: siccegge added

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

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In 8f4b9e5830479427e1ae09e3d87089c37cb3442b/macports-base (master):

Fix loss of error status from selfupdate::main

There seems to be a bug with the 'try' procedure that suppresses errors
generated by "return -code error" inside the catch clause.

Fixes: #56549

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

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