<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/1abd73ac761e5bf8ebdfe95950609d8059e3fd9f">https://github.com/macports/macports-base/commit/1abd73ac761e5bf8ebdfe95950609d8059e3fd9f</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 1abd73ac761e5bf8ebdfe95950609d8059e3fd9f
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Mon Oct 30 08:14:11 2023 +1100
<span style='display:block; white-space:pre;color:#404040;'> revupgrade: avoid possible TOCTOU error
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Make sure not to use registry entries after they could potentially have
</span><span style='display:block; white-space:pre;color:#404040;'> been uninstalled.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/66186
</span>---
src/macports1.0/macports.tcl | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 6e07ed3a5..ce7237e4b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5538,8 +5538,16 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> set status 0
array set my_options [array get macports::global_options]
set my_options(ports_revupgrade) yes
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Depending on the options, calling macports::upgrade could
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # uninstall later entries in this list. So get the info we need
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # from all the entries first.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set topsort_portnames [list]
</span> foreach port $topsort_ports {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [$port name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend topsort_portnames [$port name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach portname $topsort_portnames {
</span> if {![info exists depscache(port:$portname)]} {
unset -nocomplain my_options(ports_revupgrade_second_run) \
my_options(ports_nodeps)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5561,7 +5569,6 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> error "Error rebuilding $portname"
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- #registry::entry close $port
</span> }
if {[info exists options(ports_dryrun)] && $options(ports_dryrun)} {
</pre><pre style='margin:0'>
</pre>