[147064] trunk/base/src/port1.0/portutil.tcl

cal at macports.org cal at macports.org
Thu Mar 24 14:52:48 PDT 2016


Revision: 147064
          https://trac.macports.org/changeset/147064
Author:   cal at macports.org
Date:     2016-03-24 14:52:48 -0700 (Thu, 24 Mar 2016)
Log Message:
-----------
base: portutil: Improve msg for privilege handling

Let's have one line per privilege escalation and one line per privilege drop in
the log file, rather than two for escalation and three for the drop.
Additionally, format the messages in a similar way so it is easier to see that
they are related.

Modified Paths:
--------------
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2016-03-24 21:09:03 UTC (rev 147063)
+++ trunk/base/src/port1.0/portutil.tcl	2016-03-24 21:52:48 UTC (rev 147064)
@@ -2984,10 +2984,9 @@
 
     if { [getuid] == 0 && [geteuid] != 0 } {
     # if started with sudo but have dropped the privileges
-        ui_debug "Can't run $action on this port without elevated privileges. Escalating privileges back to root."
         seteuid $euid
         setegid $egid
-        ui_debug "euid changed to: [geteuid]. egid changed to: [getegid]."
+        ui_debug "elevating privileges for $action: euid changed to [geteuid], egid changed to [getegid]."
     } elseif { [getuid] != 0 } {
         return -code error "MacPorts requires root privileges for this action"
     }
@@ -3001,15 +3000,12 @@
     if { [geteuid] == 0 } {
         if { [catch {
                 if {[name_to_uid "$macportsuser"] != 0} {
-                    ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
-
                     #seteuid [name_to_uid [file attributes $workpath -owner]]
                     #setegid [name_to_gid [file attributes $workpath -group]]
 
                     setegid [uname_to_gid "$macportsuser"]
                     seteuid [name_to_uid "$macportsuser"]
-                    ui_debug "egid changed to: [getegid]"
-                    ui_debug "euid changed to: [geteuid]"
+                    ui_debug "dropping privileges: euid changed to [geteuid], egid changed to [getegid]."
                 }
             }]
         } {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160324/ecb3b393/attachment.html>


More information about the macports-changes mailing list