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

jmr at macports.org jmr at macports.org
Sat Oct 17 10:15:26 PDT 2009


Revision: 59597
          http://trac.macports.org/changeset/59597
Author:   jmr at macports.org
Date:     2009-10-17 10:15:23 -0700 (Sat, 17 Oct 2009)
Log Message:
-----------
don't try to set owner and group in reinplace when not root (see #20896)

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

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-10-17 16:54:11 UTC (rev 59596)
+++ trunk/base/src/port1.0/portutil.tcl	2009-10-17 17:15:23 UTC (rev 59597)
@@ -2321,16 +2321,22 @@
 # @param attributes the attributes for the file
 proc fileAttrsAsRoot {file attributes} {
     global euid macportsuser
-    if {[getuid] == 0 && [geteuid] != 0} {
-        # Started as root, but not root now
-        seteuid $euid
-        ui_debug "euid changed to: [geteuid]"
-        ui_debug "setting attributes on $file"
-        eval file attributes {$file} $attributes
-        seteuid [name_to_uid "$macportsuser"]
-        ui_debug "euid changed to: [geteuid]"
+    if {[getuid] == 0} {
+        if {[geteuid] != 0} {
+            # Started as root, but not root now
+            seteuid $euid
+            ui_debug "euid changed to: [geteuid]"
+            ui_debug "setting attributes on $file"
+            eval file attributes {$file} $attributes
+            seteuid [name_to_uid "$macportsuser"]
+            ui_debug "euid changed to: [geteuid]"
+        } else {
+            eval file attributes {$file} $attributes
+        }
     } else {
-        eval file attributes {$file} $attributes
+        # not root, so can't set owner/group
+        set permissions [lindex $attributes [expr [lsearch $attributes "-permissions"] + 1]]
+        file attributes $file -permissions $permissions
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091017/00a7eed6/attachment.html>


More information about the macports-changes mailing list