<!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>[119660] trunk/base/src</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/119660">119660</a></dd>
<dt>Author</dt> <dd>cal@macports.org</dd>
<dt>Date</dt> <dd>2014-05-03 05:41:18 -0700 (Sat, 03 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>base: Don't print a backtrace when rev-upgrade fails, handle SIGINT,SIGTERM gracefully, closes #43552</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbasesrcmacports10macportstcl">trunk/base/src/macports1.0/macports.tcl</a></li>
<li><a href="#trunkbasesrcportporttcl">trunk/base/src/port/port.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 (119659 => 119660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/macports1.0/macports.tcl        2014-05-03 09:25:09 UTC (rev 119659)
+++ trunk/base/src/macports1.0/macports.tcl        2014-05-03 12:41:18 UTC (rev 119660)
</span><span class="lines">@@ -4363,16 +4363,58 @@
</span><span class="cx">     return yes
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+##
+# Execute the rev-upgrade scan and attempt to rebuild all ports found to be
+# broken. Depends on the revupgrade_mode setting from macports.conf.
+#
+# @param opts
+#        A Tcl array serialized into a list using array get containing options
+#        for MacPorts. Options used exclusively by rev-upgrade are
+#        ports_rev-upgrade_id-loadcmd-check, a boolean indicating whether the
+#        ID load command of binaries should be check for sanity. This is mostly
+#        useful for maintainers.
+# @return 0 if report-only mode is enabled, no ports are broken, or the
+#         rebuilds finished successfully. 1 if an exception occured during the
+#         execution of rev-upgrade, 2 if the execution was aborted on user
+#         request.
</ins><span class="cx"> proc macports::revupgrade {opts} {
</span><span class="cx">     set run_loop 1
</span><span class="cx">     array set broken_port_counts {}
</span><del>-    while {$run_loop == 1} {
-        set run_loop [revupgrade_scanandrebuild broken_port_counts $opts]
</del><ins>+    try {
+        while {$run_loop == 1} {
+            set run_loop [revupgrade_scanandrebuild broken_port_counts $opts]
+        }
+        return 0
+    } catch {{POSIX SIG SIGINT} eCode eMessage} {
+        ui_debug &quot;rev-upgrade failed: $::errorInfo&quot;
+        ui_error [msgcat::mc &quot;rev-upgrade aborted: SIGINT received.&quot;]
+        return 2
+    } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+        ui_error [msgcat::mc &quot;rev-upgrade aborted: SIGTERM received.&quot;]
+        return 2
+    } catch {{*} eCode eMessage} {
+        ui_debug &quot;rev-upgrade failed: $::errorInfo&quot;
+        ui_error [msgcat::mc &quot;rev-upgrade failed: %s&quot; $eMessage]
+        return 1
</ins><span class="cx">     }
</span><del>-    return 0
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-# returns 1 if ports were rebuilt and revupgrade_scanandrebuild should be called again
</del><ins>+##
+# Helper function for rev-upgrade. Do not consider this to be part of public
+# API. Use macports::revupgrade instead.
+#
+# @param broken_port_counts_name
+#        The name of a Tcl array that's being used to store the number of times
+#        a port has been rebuilt so far.
+# @param opts
+#        A serialized version of a Tcl array that contains options for
+#        MacPorts. Options used by this method are
+#        ports_rev-upgrade_id-loadcmd-check, a boolean indicating whether the
+#        ID loadcommand of binaries should also be checked during rev-upgrade
+#        and ports_dryrun, a boolean indicating whether no action should be
+#        taken.
+# @return 1 if ports were rebuilt and this function should be called again,
+#         0 otherwise.
</ins><span class="cx"> proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span><span class="cx">     upvar $broken_port_counts_name broken_port_counts
</span><span class="cx">     array set options $opts
</span><span class="lines">@@ -4411,6 +4453,9 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">             } catch {*} {
</span><ins>+                if {${fancy_output}} {
+                    $revupgrade_progress intermission
+                }
</ins><span class="cx">                 ui_error &quot;Updating database of binaries failed&quot;
</span><span class="cx">                 throw
</span><span class="cx">             }
</span><span class="lines">@@ -4436,71 +4481,44 @@
</span><span class="cx">             $revupgrade_progress start
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        set i 1
-        foreach b $binaries {
-            if {$fancy_output} {
-                if {$binary_count &lt; 10000 || $i % 10 == 1} {
-                    $revupgrade_progress update $i $binary_count
</del><ins>+        try {
+            set i 1
+            foreach b $binaries {
+                if {$fancy_output} {
+                    if {$binary_count &lt; 10000 || $i % 10 == 1} {
+                        $revupgrade_progress update $i $binary_count
+                    }
</ins><span class="cx">                 }
</span><del>-            }
-            set bpath [$b actual_path]
-            #ui_debug &quot;${i}/${binary_count}: $bpath&quot;
-            incr i
</del><ins>+                set bpath [$b actual_path]
+                #ui_debug &quot;${i}/${binary_count}: $bpath&quot;
+                incr i
</ins><span class="cx"> 
</span><del>-            set resultlist [machista::parse_file $handle $bpath]
-            set returncode [lindex $resultlist 0]
-            set result     [lindex $resultlist 1]
</del><ins>+                set resultlist [machista::parse_file $handle $bpath]
+                set returncode [lindex $resultlist 0]
+                set result     [lindex $resultlist 1]
</ins><span class="cx"> 
</span><del>-            if {$returncode != $machista::SUCCESS} {
-                if {$returncode == $machista::EMAGIC} {
-                    # not a Mach-O file
-                    # ignore silently, these are only static libs anyway
-                    #ui_debug &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
-                } else {
-                    if {$fancy_output} {
-                        $revupgrade_progress intermission
</del><ins>+                if {$returncode != $machista::SUCCESS} {
+                    if {$returncode == $machista::EMAGIC} {
+                        # not a Mach-O file
+                        # ignore silently, these are only static libs anyway
+                        #ui_debug &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
+                    } else {
+                        if {$fancy_output} {
+                            $revupgrade_progress intermission
+                        }
+                        ui_warn &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
</ins><span class="cx">                     }
</span><del>-                    ui_warn &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
</del><ins>+                    continue;
</ins><span class="cx">                 }
</span><del>-                continue;
-            }
</del><span class="cx"> 
</span><del>-            set architecture [$result cget -mt_archs]
-            while {$architecture ne {NULL}} {
-                if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] &amp;&amp; $options(ports_rev-upgrade_id-loadcmd-check) eq {yes}} {
-                    if {[$architecture cget -mat_install_name] ne {NULL} &amp;&amp; [$architecture cget -mat_install_name] ne {}} {
-                        # check if this lib's install name actually refers to this file itself
-                        # if this is not the case software linking against this library might have erroneous load commands
-                        if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
-                            if {[string index $idloadcmdpath 0] ne {/}} {
-                                set port [registry::entry owner $bpath]
-                                if {$port ne {}} {
-                                    set portname [$port name]
-                                } else {
-                                    set portname &lt;unknown-port&gt;
-                                }
-                                if {$fancy_output} {
-                                    $revupgrade_progress intermission
-                                }
-                                ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path&quot;
-                            } elseif {![file exists $idloadcmdpath]} {
-                                set port [registry::entry owner $bpath]
-                                if {$port ne {}} {
-                                    set portname [$port name]
-                                } else {
-                                    set portname &lt;unknown-port&gt;
-                                }
-                                if {$fancy_output} {
-                                    $revupgrade_progress intermission
-                                }
-                                ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath&quot;
-                                ui_warn &quot;This is probably a bug in the $portname port and might cause problems in libraries linking against this file&quot;
-                            } else {
-
-                                set hash_this [sha256 file $bpath]
-                                set hash_idloadcmd [sha256 file $idloadcmdpath]
-
-                                if {$hash_this ne $hash_idloadcmd} {
</del><ins>+                set architecture [$result cget -mt_archs]
+                while {$architecture ne {NULL}} {
+                    if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] &amp;&amp; $options(ports_rev-upgrade_id-loadcmd-check) eq {yes}} {
+                        if {[$architecture cget -mat_install_name] ne {NULL} &amp;&amp; [$architecture cget -mat_install_name] ne {}} {
+                            # check if this lib's install name actually refers to this file itself
+                            # if this is not the case software linking against this library might have erroneous load commands
+                            if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
+                                if {[string index $idloadcmdpath 0] ne {/}} {
</ins><span class="cx">                                     set port [registry::entry owner $bpath]
</span><span class="cx">                                     if {$port ne {}} {
</span><span class="cx">                                         set portname [$port name]
</span><span class="lines">@@ -4510,85 +4528,118 @@
</span><span class="cx">                                     if {$fancy_output} {
</span><span class="cx">                                         $revupgrade_progress intermission
</span><span class="cx">                                     }
</span><del>-                                    ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file&quot;
</del><ins>+                                    ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path&quot;
+                                } elseif {![file exists $idloadcmdpath]} {
+                                    set port [registry::entry owner $bpath]
+                                    if {$port ne {}} {
+                                        set portname [$port name]
+                                    } else {
+                                        set portname &lt;unknown-port&gt;
+                                    }
+                                    if {$fancy_output} {
+                                        $revupgrade_progress intermission
+                                    }
+                                    ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath&quot;
</ins><span class="cx">                                     ui_warn &quot;This is probably a bug in the $portname port and might cause problems in libraries linking against this file&quot;
</span><ins>+                                } else {
+                                    set hash_this [sha256 file $bpath]
+                                    set hash_idloadcmd [sha256 file $idloadcmdpath]
+
+                                    if {$hash_this ne $hash_idloadcmd} {
+                                        set port [registry::entry owner $bpath]
+                                        if {$port ne {}} {
+                                            set portname [$port name]
+                                        } else {
+                                            set portname &lt;unknown-port&gt;
+                                        }
+                                        if {$fancy_output} {
+                                            $revupgrade_progress intermission
+                                        }
+                                        ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file&quot;
+                                        ui_warn &quot;This is probably a bug in the $portname port and might cause problems in libraries linking against this file&quot;
+                                    }
</ins><span class="cx">                                 }
</span><span class="cx">                             }
</span><span class="cx">                         }
</span><span class="cx">                     }
</span><del>-                }
</del><span class="cx"> 
</span><del>-                set archname [machista::get_arch_name [$architecture cget -mat_arch]]
-                if {![arch_runnable $archname]} {
-                    ui_debug &quot;skipping $archname in $bpath since this system can't run it anyway&quot;
-                    set architecture [$architecture cget -next]
-                    continue
-                }
</del><ins>+                    set archname [machista::get_arch_name [$architecture cget -mat_arch]]
+                    if {![arch_runnable $archname]} {
+                        ui_debug &quot;skipping $archname in $bpath since this system can't run it anyway&quot;
+                        set architecture [$architecture cget -next]
+                        continue
+                    }
</ins><span class="cx"> 
</span><del>-                set loadcommand [$architecture cget -mat_loadcmds]
</del><ins>+                    set loadcommand [$architecture cget -mat_loadcmds]
</ins><span class="cx"> 
</span><del>-                while {$loadcommand ne {NULL}} {
-                    if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
-                        set loadcommand [$loadcommand cget -next]
-                        continue;
-                    }
</del><ins>+                    while {$loadcommand ne {NULL}} {
+                        if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
+                            set loadcommand [$loadcommand cget -next]
+                            continue;
+                        }
</ins><span class="cx"> 
</span><del>-                    set libresultlist [machista::parse_file $handle $filepath]
-                    set libreturncode [lindex $libresultlist 0]
-                    set libresult     [lindex $libresultlist 1]
</del><ins>+                        set libresultlist [machista::parse_file $handle $filepath]
+                        set libreturncode [lindex $libresultlist 0]
+                        set libresult     [lindex $libresultlist 1]
</ins><span class="cx"> 
</span><del>-                    if {$libreturncode != $machista::SUCCESS} {
-                        if {![info exists files_warned_about($filepath)]} {
-                            if {$fancy_output} {
-                                $revupgrade_progress intermission
</del><ins>+                        if {$libreturncode != $machista::SUCCESS} {
+                            if {![info exists files_warned_about($filepath)]} {
+                                if {$fancy_output} {
+                                    $revupgrade_progress intermission
+                                }
+                                ui_info &quot;Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)&quot;
+                                set files_warned_about($filepath) yes
</ins><span class="cx">                             }
</span><del>-                            ui_info &quot;Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)&quot;
-                            set files_warned_about($filepath) yes
</del><ins>+                            if {$libreturncode == $machista::EFILE} {
+                                ui_debug &quot;Marking $bpath as broken&quot;
+                                lappend broken_files $bpath
+                            }
+                            set loadcommand [$loadcommand cget -next]
+                            continue;
</ins><span class="cx">                         }
</span><del>-                        if {$libreturncode == $machista::EFILE} {
-                            ui_debug &quot;Marking $bpath as broken&quot;
-                            lappend broken_files $bpath
-                        }
-                        set loadcommand [$loadcommand cget -next]
-                        continue;
-                    }
</del><span class="cx"> 
</span><del>-                    set libarchitecture [$libresult cget -mt_archs]
-                    set libarch_found false;
-                    while {$libarchitecture ne {NULL}} {
-                        if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
-                            set libarchitecture [$libarchitecture cget -next]
-                            continue;
</del><ins>+                        set libarchitecture [$libresult cget -mt_archs]
+                        set libarch_found false;
+                        while {$libarchitecture ne {NULL}} {
+                            if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
+                                set libarchitecture [$libarchitecture cget -next]
+                                continue;
+                            }
+
+                            if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] &amp;&amp; [$loadcommand cget -mlt_comp_version] &gt; [$libarchitecture cget -mat_comp_version]} {
+                                if {$fancy_output} {
+                                    $revupgrade_progress intermission
+                                }
+                                ui_info &quot;Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]&quot;
+                                ui_debug &quot;Marking $bpath as broken&quot;
+                                lappend broken_files $bpath
+                            }
+
+                            set libarch_found true;
+                            break;
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] &amp;&amp; [$loadcommand cget -mlt_comp_version] &gt; [$libarchitecture cget -mat_comp_version]} {
-                            if {$fancy_output} {
-                                $revupgrade_progress intermission
</del><ins>+                        if {$libarch_found eq &quot;false&quot;} {
+                            ui_debug &quot;Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath&quot;
+                            if {[path_is_in_prefix $filepath]} {
+                                ui_debug &quot;Marking $bpath as broken&quot;
+                                lappend broken_files $bpath
+                            } else {
+                                ui_debug &quot;Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file outside prefix referenced from $bpath&quot;
+                                # ui_debug &quot;   How did you get that compiled anyway?&quot;
</ins><span class="cx">                             }
</span><del>-                            ui_info &quot;Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]&quot;
-                            ui_debug &quot;Marking $bpath as broken&quot;
-                            lappend broken_files $bpath
</del><span class="cx">                         }
</span><del>-
-                        set libarch_found true;
-                        break;
</del><ins>+                        set loadcommand [$loadcommand cget -next]
</ins><span class="cx">                     }
</span><span class="cx"> 
</span><del>-                    if {$libarch_found eq &quot;false&quot;} {
-                        ui_debug &quot;Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath&quot;
-                        if {[path_is_in_prefix $filepath]} {
-                            ui_debug &quot;Marking $bpath as broken&quot;
-                            lappend broken_files $bpath
-                        } else {
-                            ui_debug &quot;Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file outside prefix referenced from $bpath&quot;
-                            # ui_debug &quot;   How did you get that compiled anyway?&quot;
-                        }
-                    }
-                    set loadcommand [$loadcommand cget -next]
</del><ins>+                    set architecture [$architecture cget -next]
</ins><span class="cx">                 }
</span><del>-
-                set architecture [$architecture cget -next]
</del><span class="cx">             }
</span><ins>+        } catch {*} {
+            if {$fancy_output} {
+                $revupgrade_progress intermission
+            }
+            throw
</ins><span class="cx">         }
</span><span class="cx">         if {$fancy_output} {
</span><span class="cx">             $revupgrade_progress finish
</span></span></pre></div>
<a id="trunkbasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port/port.tcl (119659 => 119660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port/port.tcl        2014-05-03 09:25:09 UTC (rev 119659)
+++ trunk/base/src/port/port.tcl        2014-05-03 12:41:18 UTC (rev 119660)
</span><span class="lines">@@ -2733,9 +2733,12 @@
</span><span class="cx"> 
</span><span class="cx"> proc action_revupgrade { action portlist opts } {
</span><span class="cx">     set status [macports::revupgrade $opts]
</span><del>-    if {$status != 0} {
-        print_tickets_url
</del><ins>+    switch $status {
+        1 {
+            print_tickets_url
+        }
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return $status
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>