<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[146724] trunk/base/src/macports1.0/macports.tcl</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/146724">146724</a></dd>
<dt>Author</dt> <dd>petr@macports.org</dd>
<dt>Date</dt> <dd>2016-03-15 15:07:02 -0700 (Tue, 15 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>base: fix more passing of signals in macports.tcl</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbasesrcmacports10macportstcl">trunk/base/src/macports1.0/macports.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbasesrcmacports10macportstcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/macports1.0/macports.tcl (146723 => 146724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/macports1.0/macports.tcl        2016-03-15 20:17:31 UTC (rev 146723)
+++ trunk/base/src/macports1.0/macports.tcl        2016-03-15 22:07:02 UTC (rev 146724)
</span><span class="lines">@@ -1267,17 +1267,22 @@
</span><span class="cx">     file delete -force &quot;${target_dir}/com.apple.dt.Xcode.plist&quot;
</span><span class="cx">     if {[file isfile $user_plist]} {
</span><span class="cx">         if {![file isdirectory $target_dir]} {
</span><del>-            if {[catch {file mkdir $target_dir} result]} {
-                ui_warn &quot;Failed to create Library/Preferences in ${target_homedir}: $result&quot;
</del><ins>+            try -pass_signal {
+                file mkdir $target_dir
+            } catch {{*} eCode eMessage} {
+                ui_warn &quot;Failed to create Library/Preferences in ${target_homedir}: $eMessage&quot;
</ins><span class="cx">                 return
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        if {[file writable $target_dir] &amp;&amp; [catch {
</del><ins>+        try -pass_signal {
+            if {![file writable $target_dir]} {
+                error &quot;${target_dir} is not writable&quot;
+            }
</ins><span class="cx">             ui_debug &quot;Copying $user_plist to $target_dir&quot;
</span><span class="cx">             file copy -force $user_plist $target_dir
</span><span class="cx">             file attributes ${target_dir}/com.apple.dt.Xcode.plist -owner $macportsuser -permissions 0644
</span><del>-        } result]} {
-            ui_warn &quot;Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $result&quot;
</del><ins>+        } catch {{*} eCode eMessage} {
+            ui_warn &quot;Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $eMessage&quot;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -2459,7 +2464,9 @@
</span><span class="cx">         switch -regexp -- [macports::getprotocol $source] {
</span><span class="cx">             {^file$} {
</span><span class="cx">                 set portdir [macports::getportdir $source]
</span><del>-                if {[catch {macports::GetVCSUpdateCmd $portdir} repoInfo]} {
</del><ins>+                try -pass_signal {
+                    set repoInfo [macports::GetVCSUpdateCmd $portdir] 
+                } catch {*} {
</ins><span class="cx">                     ui_debug $::errorInfo
</span><span class="cx">                     ui_info &quot;Could not access contents of $portdir&quot;
</span><span class="cx">                     incr numfailed
</span><span class="lines">@@ -2467,7 +2474,9 @@
</span><span class="cx">                 }
</span><span class="cx">                 if {[llength $repoInfo]} {
</span><span class="cx">                     lassign $repoInfo vcs cmd
</span><del>-                    if {[catch {macports::UpdateVCS $cmd $portdir}]} {
</del><ins>+                    try -pass_signal {
+                        macports::UpdateVCS $cmd $portdir
+                    } catch {*} {
</ins><span class="cx">                         ui_debug $::errorInfo
</span><span class="cx">                         ui_info &quot;Syncing local $vcs ports tree failed&quot;
</span><span class="cx">                         incr numfailed
</span><span class="lines">@@ -2497,8 +2506,9 @@
</span><span class="cx">                 }
</span><span class="cx">                 # Do rsync fetch
</span><span class="cx">                 set rsync_commandline &quot;$macports::autoconf::rsync_path $rsync_options $exclude_option $source $destdir&quot;
</span><del>-                ui_debug $rsync_commandline
-                if {[catch {system $rsync_commandline}]} {
</del><ins>+                try -pass_signal {
+                    system $rsync_commandline
+                } catch {*} {
</ins><span class="cx">                     ui_error &quot;Synchronization of the local ports tree failed doing rsync&quot;
</span><span class="cx">                     incr numfailed
</span><span class="cx">                     continue
</span><span class="lines">@@ -2508,8 +2518,9 @@
</span><span class="cx">                     # verify signature for tarball
</span><span class="cx">                     global macports::archivefetch_pubkeys
</span><span class="cx">                     set rsync_commandline &quot;$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir&quot;
</span><del>-                    ui_debug $rsync_commandline
-                    if {[catch {system $rsync_commandline}]} {
</del><ins>+                    try -pass_signal {
+                        system $rsync_commandline
+                    } catch {*} {
</ins><span class="cx">                         ui_error &quot;Synchronization of the ports tree signature failed doing rsync&quot;
</span><span class="cx">                         incr numfailed
</span><span class="cx">                         continue
</span><span class="lines">@@ -2519,13 +2530,14 @@
</span><span class="cx">                     set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
</span><span class="cx">                     set verified 0
</span><span class="cx">                     foreach pubkey $macports::archivefetch_pubkeys {
</span><del>-                        if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
</del><ins>+                        try -pass_signal {
+                            exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball
</ins><span class="cx">                             set verified 1
</span><span class="cx">                             ui_debug &quot;successful verification with key $pubkey&quot;
</span><span class="cx">                             break
</span><del>-                        } else {
</del><ins>+                        } catch {{*} eCode eMessage} {
</ins><span class="cx">                             ui_debug &quot;failed verification with key $pubkey&quot;
</span><del>-                            ui_debug &quot;openssl output: $result&quot;
</del><ins>+                            ui_debug &quot;openssl output: $eMessage&quot;
</ins><span class="cx">                         }
</span><span class="cx">                     }
</span><span class="cx">                     if {!$verified} {
</span><span class="lines">@@ -2538,9 +2550,10 @@
</span><span class="cx">                     set tar [macports::findBinary tar $macports::autoconf::tar_path]
</span><span class="cx">                     file mkdir ${destdir}/tmp
</span><span class="cx">                     set tar_cmd &quot;$tar -C ${destdir}/tmp -xf $tarball&quot;
</span><del>-                    ui_debug $tar_cmd
-                    if {[catch {system $tar_cmd}]} {
-                        ui_error &quot;Failed to extract ports tree from tarball!&quot;
</del><ins>+                    try -pass_signal {
+                        system $tar_cmd
+                    } catch {{*} eCode eMessage} {
+                        ui_error &quot;Failed to extract ports tree from tarball: $eMessage&quot;
</ins><span class="cx">                         incr numfailed
</span><span class="cx">                         continue
</span><span class="cx">                     }
</span><span class="lines">@@ -2569,10 +2582,9 @@
</span><span class="cx">                     }
</span><span class="cx">                     set remote_indexfile &quot;${index_source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex&quot;
</span><span class="cx">                     set rsync_commandline &quot;$macports::autoconf::rsync_path $rsync_options $remote_indexfile $destdir&quot;
</span><del>-                    ui_debug $rsync_commandline
-                    if {[catch {system $rsync_commandline}]} {
-                        ui_debug &quot;Synchronization of the PortIndex failed doing rsync&quot;
-                    } else {
</del><ins>+                    try -pass_signal {
+                        system $rsync_commandline
+                        
</ins><span class="cx">                         set ok 1
</span><span class="cx">                         set needs_portindex false
</span><span class="cx">                         if {$is_tarball} {
</span><span class="lines">@@ -2580,31 +2592,34 @@
</span><span class="cx">                             set needs_portindex true
</span><span class="cx">                             # verify signature for PortIndex
</span><span class="cx">                             set rsync_commandline &quot;$macports::autoconf::rsync_path $rsync_options ${remote_indexfile}.rmd160 $destdir&quot;
</span><del>-                            ui_debug $rsync_commandline
-                            if {![catch {system $rsync_commandline}]} {
-                                foreach pubkey $macports::archivefetch_pubkeys {
-                                    if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex} result]} {
-                                        set ok 1
-                                        set needs_portindex false
-                                        ui_debug &quot;successful verification with key $pubkey&quot;
-                                        break
-                                    } else {
-                                        ui_debug &quot;failed verification with key $pubkey&quot;
-                                        ui_debug &quot;openssl output: $result&quot;
-                                    }
</del><ins>+                            system $rsync_commandline
+                            foreach pubkey $macports::archivefetch_pubkeys {
+                                try -pass_signal {
+                                    exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex
+                                    set ok 1
+                                    set needs_portindex false
+                                    ui_debug &quot;successful verification with key $pubkey&quot;
+                                    break
+                                } catch {{*} eCode eMessage} {
+                                    ui_debug &quot;failed verification with key $pubkey&quot;
+                                    ui_debug &quot;openssl output: $eMessage&quot;
</ins><span class="cx">                                 }
</span><del>-                                if {$ok} {
-                                    # move PortIndex into place
-                                    file rename -force ${destdir}/PortIndex ${destdir}/ports/
-                                }
</del><span class="cx">                             }
</span><ins>+                            if {$ok} {
+                                # move PortIndex into place
+                                file rename -force ${destdir}/PortIndex ${destdir}/ports/
+                            }
</ins><span class="cx">                         }
</span><span class="cx">                         if {$ok} {
</span><span class="cx">                             mports_generate_quickindex $indexfile
</span><span class="cx">                         }
</span><ins>+                    } catch {*} {
+                        ui_debug &quot;Synchronization of the PortIndex failed doing rsync&quot;
</ins><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-                if {[catch {system &quot;chmod -R a+r \&quot;$destdir\&quot;&quot;}]} {
</del><ins>+                try -pass_signal {
+                    system [list chmod -R a+r $destdir]
+                } catch {*} {
</ins><span class="cx">                     ui_warn &quot;Setting world read permissions on parts of the ports tree failed, need root?&quot;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -2625,6 +2640,7 @@
</span><span class="cx">                 set updated 1
</span><span class="cx">                 if {[file isdirectory $destdir]} {
</span><span class="cx">                     set moddate [file mtime $destdir]
</span><ins>+                    # XXX, catch, don't fix rarely used code
</ins><span class="cx">                     if {[catch {set updated [curl isnewer $source $moddate]} error]} {
</span><span class="cx">                         ui_warn &quot;Cannot check if $source was updated, ($error)&quot;
</span><span class="cx">                     }
</span><span class="lines">@@ -2765,9 +2781,9 @@
</span><span class="cx">     foreach source $sources {
</span><span class="cx">         set source [lindex $source 0]
</span><span class="cx">         set protocol [macports::getprotocol $source]
</span><del>-        if {[catch {set fd [open [macports::getindex $source] r]} result]} {
-            ui_warn &quot;Can't open index file for source: $source&quot;
-        } else {
</del><ins>+        try -pass_signal {
+            set fd [open [macports::getindex $source] r]
+
</ins><span class="cx">             try -pass_signal {
</span><span class="cx">                 incr found 1
</span><span class="cx">                 while {[gets $fd line] &gt;= 0} {
</span><span class="lines">@@ -2850,6 +2866,8 @@
</span><span class="cx">             } finally {
</span><span class="cx">                 close $fd
</span><span class="cx">             }
</span><ins>+        } catch {*} {
+            ui_warn &quot;Can't open index file for source: $source&quot;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if {!$found} {
</span><span class="lines">@@ -2952,7 +2970,9 @@
</span><span class="cx">     foreach source $sources {
</span><span class="cx">         set source [lindex $source 0]
</span><span class="cx">         set protocol [macports::getprotocol $source]
</span><del>-        if {![catch {set fd [open [macports::getindex $source] r]} result]} {
</del><ins>+        try -pass_signal {
+            set fd [open [macports::getindex $source] r]
+
</ins><span class="cx">             try -pass_signal {
</span><span class="cx">                 incr found 1
</span><span class="cx">                 while {[gets $fd line] &gt;= 0} {
</span><span class="lines">@@ -2987,7 +3007,7 @@
</span><span class="cx">             } finally {
</span><span class="cx">                 close $fd
</span><span class="cx">             }
</span><del>-        } else {
</del><ins>+        } catch {*} {
</ins><span class="cx">             ui_warn &quot;Can't open index file for source: $source&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -3019,21 +3039,24 @@
</span><span class="cx">         }
</span><span class="cx">         if {![file exists ${index}.quick]} {
</span><span class="cx">             ui_warn &quot;No quick index file found, attempting to generate one for source: $source&quot;
</span><del>-            if {[catch {set quicklist [mports_generate_quickindex $index]}]} {
</del><ins>+            try -pass_signal {
+                set quicklist [mports_generate_quickindex $index]
+            } catch {*} {
</ins><span class="cx">                 incr sourceno
</span><span class="cx">                 continue
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         # only need to read the quick index file if we didn't just update it
</span><span class="cx">         if {![info exists quicklist]} {
</span><del>-            if {[catch {set fd [open ${index}.quick r]} result]} {
</del><ins>+            try -pass_signal {
+                set fd [open ${index}.quick r]
+            } catch {*} {
</ins><span class="cx">                 ui_warn &quot;Can't open quick index file for source: $source&quot;
</span><span class="cx">                 incr sourceno
</span><span class="cx">                 continue
</span><del>-            } else {
-                set quicklist [read $fd]
-                close $fd
</del><span class="cx">             }
</span><ins>+            set quicklist [read $fd]
+            close $fd
</ins><span class="cx">         }
</span><span class="cx">         foreach entry [split $quicklist \n] {
</span><span class="cx">             set quick_index(${sourceno},[lindex $entry 0]) [lindex $entry 1]
</span><span class="lines">@@ -3060,30 +3083,38 @@
</span><span class="cx"> #         is corrupt), or the quick index generation failed for some other
</span><span class="cx"> #         reason.
</span><span class="cx"> proc mports_generate_quickindex {index} {
</span><del>-    if {[catch {set indexfd [open $index r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
</del><ins>+    try -pass_signal {
+        set indexfd -1
+        set quickfd -1
+        set indexfd [open $index r]
+        set quickfd [open ${index}.quick w]
+    } catch {*} {
</ins><span class="cx">         ui_warn &quot;Can't open index file: $index&quot;
</span><span class="cx">         return -code error
</span><del>-    } else {
-        try -pass_signal {
</del><ins>+    }
+    try -pass_signal {
+        set offset [tell $indexfd]
+        set quicklist {}
+        while {[gets $indexfd line] &gt;= 0} {
+            if {[llength $line] != 2} {
+                continue
+            }
+            set name [lindex $line 0]
+            append quicklist &quot;[string tolower $name] $offset\n&quot;
+
+            set len [lindex $line 1]
+            read $indexfd $len
</ins><span class="cx">             set offset [tell $indexfd]
</span><del>-            set quicklist {}
-            while {[gets $indexfd line] &gt;= 0} {
-                if {[llength $line] != 2} {
-                    continue
-                }
-                set name [lindex $line 0]
-                append quicklist &quot;[string tolower $name] $offset\n&quot;
-
-                set len [lindex $line 1]
-                read $indexfd $len
-                set offset [tell $indexfd]
-            }
-            puts -nonewline $quickfd $quicklist
-        } catch {{*} eCode eMessage} {
-            ui_warn &quot;It looks like your PortIndex file $index may be corrupt.&quot;
-            throw
-        } finally {
</del><ins>+        }
+        puts -nonewline $quickfd $quicklist
+    } catch {{*} eCode eMessage} {
+        ui_warn &quot;It looks like your PortIndex file $index may be corrupt.&quot;
+        throw
+    } finally {
+        if {$indexfd != -1} {
</ins><span class="cx">             close $indexfd
</span><ins>+        }
+        if {$quickfd != -1} {
</ins><span class="cx">             close $quickfd
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -3246,11 +3277,13 @@
</span><span class="cx">             }
</span><span class="cx">             if {$parse} {
</span><span class="cx">                 # Find the porturl
</span><del>-                if {[catch {set res [mportlookup $dep_portname]} error]} {
</del><ins>+                try -pass_signal {
+                    set res [mportlookup $dep_portname]
+                } catch {{*} eCode eMessage} {
</ins><span class="cx">                     global errorInfo
</span><span class="cx">                     ui_msg {}
</span><span class="cx">                     ui_debug $errorInfo
</span><del>-                    ui_error &quot;Internal error: port lookup failed: $error&quot;
</del><ins>+                    ui_error &quot;Internal error: port lookup failed: $eMessage&quot;
</ins><span class="cx">                     return 1
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -3538,28 +3571,33 @@
</span><span class="cx"> 
</span><span class="cx">     # sync the MacPorts sources
</span><span class="cx">     ui_msg &quot;$macports::ui_prefix Updating MacPorts base sources using rsync&quot;
</span><del>-    if {[catch {system &quot;$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path&quot;} result]} {
-       return -code error &quot;Error synchronizing MacPorts sources: $result&quot;
</del><ins>+    try -pass_signal {
+        system &quot;$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path&quot;
+    } catch {{*} eCode eMessage} {
+        return -code error &quot;Error synchronizing MacPorts sources: $eMessage&quot;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if {$is_tarball} {
</span><span class="cx">         # verify signature for tarball
</span><span class="cx">         global macports::archivefetch_pubkeys
</span><del>-        if {[catch {system &quot;$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path&quot;} result]} {
-            return -code error &quot;Error synchronizing MacPorts source signature: $result&quot;
</del><ins>+        try -pass_signal {
+            system &quot;$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path&quot;
+        } catch {{*} eCode eMessage} {
+            return -code error &quot;Error synchronizing MacPorts source signature: $eMessage&quot;
</ins><span class="cx">         }
</span><span class="cx">         set openssl [findBinary openssl $macports::autoconf::openssl_path]
</span><span class="cx">         set tarball ${mp_source_path}/[file tail $rsync_dir]
</span><span class="cx">         set signature ${tarball}.rmd160
</span><span class="cx">         set verified 0
</span><span class="cx">         foreach pubkey $macports::archivefetch_pubkeys {
</span><del>-            if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
</del><ins>+            try -pass_signal {
+                exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball
</ins><span class="cx">                 set verified 1
</span><span class="cx">                 ui_debug &quot;successful verification with key $pubkey&quot;
</span><span class="cx">                 break
</span><del>-            } else {
</del><ins>+            }  catch {{*} eCode eMessage} {
</ins><span class="cx">                 ui_debug &quot;failed verification with key $pubkey&quot;
</span><del>-                ui_debug &quot;openssl output: $result&quot;
</del><ins>+                ui_debug &quot;openssl output: $eMessage&quot;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         if {!$verified} {
</span><span class="lines">@@ -3570,8 +3608,9 @@
</span><span class="cx">         set tar [macports::findBinary tar $macports::autoconf::tar_path]
</span><span class="cx">         file mkdir ${mp_source_path}/tmp
</span><span class="cx">         set tar_cmd &quot;$tar -C ${mp_source_path}/tmp -xf $tarball&quot;
</span><del>-        ui_debug $tar_cmd
-        if {[catch {system $tar_cmd}]} {
</del><ins>+        try -pass_signal {
+            system $tar_cmd
+        } catch {*} {
</ins><span class="cx">             return -code error &quot;Failed to extract MacPorts sources from tarball!&quot;
</span><span class="cx">         }
</span><span class="cx">         file delete -force ${mp_source_path}/base
</span><span class="lines">@@ -3615,8 +3654,10 @@
</span><span class="cx">             # use prefabricated PortIndex files and signal if it couldn't
</span><span class="cx">             lappend optionslist no_reindex 1 needed_portindex_var needed_portindex
</span><span class="cx">         }
</span><del>-        if {[catch {mportsync $optionslist} result]} {
-            return -code error &quot;Couldn't sync the ports tree: $result&quot;
</del><ins>+        try {
+            mportsync $optionslist
+        }  catch {{*} eCode eMessage} {
+            return -code error &quot;Couldn't sync the ports tree: $eMessage&quot;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3656,8 +3697,10 @@
</span><span class="cx"> 
</span><span class="cx">             # do the actual configure, build and installation of new base
</span><span class="cx">             ui_msg &quot;Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}\n&quot;
</span><del>-            if {[catch {system &quot;cd $mp_source_path &amp;&amp; ${cc_arg}./configure $configure_args &amp;&amp; make SELFUPDATING=1 &amp;&amp; make install SELFUPDATING=1&quot;} result]} {
-                return -code error &quot;Error installing new MacPorts base: $result&quot;
</del><ins>+            try {
+                system -W $mp_source_path &quot;${cc_arg}./configure $configure_args &amp;&amp; make SELFUPDATING=1 &amp;&amp; make install SELFUPDATING=1&quot;
+            } catch {{*} eCode eMessage} {
+                return -code error &quot;Error installing new MacPorts base: $eMessage&quot;
</ins><span class="cx">             }
</span><span class="cx">             if {[info exists updatestatus]} {
</span><span class="cx">                 set updatestatus yes
</span><span class="lines">@@ -3672,8 +3715,10 @@
</span><span class="cx">     # set the MacPorts sources to the right owner
</span><span class="cx">     set sources_owner [file attributes [file join $portdbpath sources/] -owner]
</span><span class="cx">     ui_debug &quot;Setting MacPorts sources ownership to $sources_owner&quot;
</span><del>-    if {[catch {exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]} result]} {
-        return -code error &quot;Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $result&quot;
</del><ins>+    try {
+        exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]
+    }  catch {{*} eCode eMessage} {
+        return -code error &quot;Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $eMessage&quot;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if {![info exists options(ports_selfupdate_nosync)] || !$options(ports_selfupdate_nosync)} {
</span><span class="lines">@@ -3755,10 +3800,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # check if the port is in tree
</span><del>-    if {[catch {mportlookup $portname} result]} {
</del><ins>+    try {
+        mportlookup $portname
+    } catch {{*} eCode eMessage} {
</ins><span class="cx">         global errorInfo
</span><span class="cx">         ui_debug $errorInfo
</span><del>-        ui_error &quot;port lookup failed: $result&quot;
</del><ins>+        ui_error &quot;port lookup failed: $eMessage&quot;
</ins><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="cx">     # argh! port doesnt exist!
</span></span></pre>
</div>
</div>

</body>
</html>