[61313] trunk/base

jmr at macports.org jmr at macports.org
Tue Dec 8 08:02:06 PST 2009


Revision: 61313
          http://trac.macports.org/changeset/61313
Author:   jmr at macports.org
Date:     2009-12-08 08:02:03 -0800 (Tue, 08 Dec 2009)
Log Message:
-----------
only use autoconf'd macportsuser as fallback for when it is not set in macports.conf, create work symlink before dropping privileges, make sure priveleges are not dropped when opening log files

Modified Paths:
--------------
    trunk/base/doc/macports.conf.in
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/macports1.0/macports_autoconf.tcl.in
    trunk/base/src/port1.0/port_autoconf.tcl.in
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/doc/macports.conf.in
===================================================================
--- trunk/base/doc/macports.conf.in	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/doc/macports.conf.in	2009-12-08 16:02:03 UTC (rev 61313)
@@ -5,7 +5,7 @@
 prefix			@prefix_expanded@
 
 # Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
-macportsuser		@RUNUSR@
+#macportsuser		@RUNUSR@
 
 # Where to store MacPorts working data
 portdbpath		@localstatedir_expanded@/macports

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/macports1.0/macports.tcl	2009-12-08 16:02:03 UTC (rev 61313)
@@ -52,7 +52,7 @@
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
         registry.path registry.format registry.installtype portarchivemode portarchivepath \
         portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
-        rsync_options rsync_dir startupitem_type place_worksymlink \
+        rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir current_stage frameworks_dir developer_dir universal_archs build_arch $user_options"
 
@@ -111,6 +111,9 @@
 proc macports::init_logging {portname} {
     global ::debuglog ::debuglogname macports::channels macports::portdbpath
 
+    if {[getuid] == 0 && [geteuid] != 0} {
+        seteuid 0
+    }
     set logspath [file join $macports::portdbpath logs]
     if {([file exists $logspath] && ![file writable $logspath]) || (![file exists $logspath] && ![file writable $macports::portdbpath])} {
         ui_debug "logging disabled, can't write to $logspath"
@@ -722,7 +725,12 @@
     if {![info exists macports::buildmakejobs]} {
         set macports::buildmakejobs 0
     }
-    
+
+    # default user to run as when privileges can be dropped
+    if {![info exists macports::macportsuser]} {
+        set macports::macportsuser $macports::autoconf::macportsuser
+    }
+
     # Default Xcode Tools path
     if {![info exists macports::developer_dir]} {
         set macports::developer_dir "/Developer"

Modified: trunk/base/src/macports1.0/macports_autoconf.tcl.in
===================================================================
--- trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/macports1.0/macports_autoconf.tcl.in	2009-12-08 16:02:03 UTC (rev 61313)
@@ -37,6 +37,7 @@
     variable macports_conf_path "@MPCONFIGDIR_EXPANDED@"
     variable macports_version "@MACPORTS_VERSION@"
     variable macports_user_dir "~/.macports"
+    variable macportsuser "@RUNUSR@"
     variable open_path "@OPEN@"
     variable rsync_path "@RSYNC@"
     variable tar_command "@TAR_CMD@"

Modified: trunk/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- trunk/base/src/port1.0/port_autoconf.tcl.in	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/port1.0/port_autoconf.tcl.in	2009-12-08 16:02:03 UTC (rev 61313)
@@ -69,5 +69,4 @@
 	variable install_user "@DSTUSR@"
 	variable install_group "@DSTGRP@"
 	variable prefix "@prefix_expanded@"
-	variable macportsuser "@RUNUSR@"
 }

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/port1.0/portdestroot.tcl	2009-12-08 16:02:03 UTC (rev 61313)
@@ -88,7 +88,7 @@
 
 proc portdestroot::destroot_start {args} {
     global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
-    global destroot.umask destroot.asroot macportsuser euid egid
+    global destroot.umask destroot.asroot euid egid
     global applications_dir frameworks_dir
     variable oldmask
 

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/port1.0/portmain.tcl	2009-12-08 16:02:03 UTC (rev 61313)
@@ -44,7 +44,7 @@
 }
 
 # define options
-options prefix macportsuser name version revision epoch categories maintainers
+options prefix name version revision epoch categories maintainers
 options long_description description homepage license provides conflicts replaced_by
 options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
 options universal_variant os.universal_supported
@@ -76,7 +76,6 @@
 default worksrcpath {[file join $workpath $worksrcdir]}
 
 # Configure settings
-default macportsuser {${portutil::autoconf::macportsuser}}
 default install.user {${portutil::autoconf::install_user}}
 default install.group {${portutil::autoconf::install_group}}
 

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-12-08 14:54:21 UTC (rev 61312)
+++ trunk/base/src/port1.0/portutil.tcl	2009-12-08 16:02:03 UTC (rev 61313)
@@ -1505,6 +1505,11 @@
     if {![file isdirectory $workpath]} {
         file mkdir $workpath
         chownAsRoot $portbuildpath
+        # Create a symlink to the workpath for port authors
+        if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
+            ui_debug "Attempting ln -sf $workpath $worksymlink"
+            ln -sf $workpath $worksymlink
+        }
     }
     
     if { [getuid] != 0 } {
@@ -1552,12 +1557,6 @@
         }
     }
 
-    # Create a symlink to the workpath for port authors
-    if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
-        ui_debug "Attempting ln -sf $workpath $worksymlink"
-        ln -sf $workpath $worksymlink
-    }
-
     set fd [open $statefile a+]
     if {[catch {flock $fd -exclusive -noblock} result]} {
         if {"$result" == "EAGAIN"} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091208/18a14e79/attachment.html>


More information about the macports-changes mailing list