<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/f5092bdf6c97717e99edd16923f2e33069345fb2">https://github.com/macports/macports-base/commit/f5092bdf6c97717e99edd16923f2e33069345fb2</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit f5092bdf6c97717e99edd16923f2e33069345fb2
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Tue Mar 27 03:20:35 2018 +0200
<span style='display:block; white-space:pre;color:#404040;'> trace: Use mktemp to generate FIFO name
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Provide the mktemp template in a namespace variable to make it
</span><span style='display:block; white-space:pre;color:#404040;'> accessible from other packages.
</span>---
src/port1.0/porttrace.tcl | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/porttrace.tcl b/src/port1.0/porttrace.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 9d5256a..49f65a5 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/porttrace.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/porttrace.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -42,6 +42,15 @@ namespace eval porttrace {
</span> variable fifo
##
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # The mktemp(3) template used to generate a filename for the fifo.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Note that Unix sockets are limited to 109 characters and that the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # macports user must be able to connect to the socket (and in case of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # non-root installations, the current user, too). We're not prefixing the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # path in /tmp with a separate macports-specific directory, because this
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # might not be writable by all users.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variable fifo_mktemp_template "/tmp/macports-trace-XXXXXX"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ##
</span> # The Tcl thread that runs the server side of trace mode and deals with
# requests from traced processes.
variable thread
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -126,20 +135,16 @@ namespace eval porttrace {
</span> portpath prefix
variable fifo
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ variable fifo_mktemp_template
</span>
if {[catch {package require Thread} error]} {
ui_warn "Trace mode requires Tcl Thread package ($error)"
return 0
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Select a name for the socket to be used to communicate with the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # processes being traced. Note that Unix sockets are limited to 109
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # characters and that the macports user must be able to connect to
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # the socket (and in case of non-root installations, the current user,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # too). We're not prefixing the path in /tmp with a separate
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # macports-specific directory, because this might not be writable by all
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # users.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set fifo "/tmp/macports-trace-[pid]-[expr {int(rand() * 10000)}]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Generate a name for the socket to be used to communicate with the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # processes being traced.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set fifo [mktemp $fifo_mktemp_template]
</span>
# Make sure the socket doesn't exist yet (this would cause errors
# later)
</pre><pre style='margin:0'>
</pre>