<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/b3f44ca4dd3b8294a4cabf77d577430d0cb33250">https://github.com/macports/macports-base/commit/b3f44ca4dd3b8294a4cabf77d577430d0cb33250</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b3f44ca4dd3b8294a4cabf77d577430d0cb33250
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Sat Nov 5 03:44:02 2016 +0100
<span style='display:block; white-space:pre;color:#404040;'> UpdateVCS: put SSH_AUTH_SOCK into command env
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Put SSH_AUTH_SOCK back into the environment when updating the ports tree
</span><span style='display:block; white-space:pre;color:#404040;'> to allow a VCS such as git to access remote hosts via SSH.
</span>---
src/macports1.0/macports.tcl | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 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 b8e7072..6c39fb5 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;'>@@ -58,7 +58,7 @@ namespace eval macports {
</span> variable user_options {}
variable portinterp_options "\
portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- registry.path registry.format user_home user_path \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry.path registry.format user_home user_path user_ssh_auth_sock \
</span> portarchivetype archivefetch_pubkeys portautoclean porttrace keeplogs portverbose destroot_umask \
rsync_server rsync_options rsync_dir startupitem_type startupitem_install place_worksymlink macportsuser \
configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -677,6 +677,11 @@ proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
</span> # Save the path for future processing
set macports::user_path $env(PATH)
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Save SSH_AUTH_SOCK for ports tree sync
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists env(SSH_AUTH_SOCK)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set macports::user_ssh_auth_sock $env(SSH_AUTH_SOCK)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # Configure the search path for configuration files
set conf_files {}
lappend conf_files ${macports_conf_path}/macports.conf
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2449,7 +2454,7 @@ proc macports::GetVCSUpdateCmd portDir {
</span> # This proc could probably be generalized and used elsewhere.
#
proc macports::UpdateVCS {cmd dir} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global env
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global env macports::user_ssh_auth_sock
</span> if {[getuid] == 0} {
# Must change egid before dropping root euid.
set oldEGID [getegid]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2458,18 +2463,23 @@ proc macports::UpdateVCS {cmd dir} {
</span> set oldEUID [geteuid]
set newEUID [name_to_uid [file attributes $dir -owner]]
seteuid $newEUID
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set oldHOME $env(HOME)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set newHOME [getpwuid $newEUID dir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set env(HOME) $newHOME
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "euid/egid changed to: $newEUID/$newEGID, HOME changed to: $newHOME"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set oldEnv [array get env]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set env(HOME) [getpwuid $newEUID dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set envdebug "HOME=$env(HOME)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists macports::user_ssh_auth_sock]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set env(SSH_AUTH_SOCK) $macports::user_ssh_auth_sock
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ append envdebug " SSH_AUTH_SOCK=$env(SSH_AUTH_SOCK)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "euid/egid changed to: $newEUID/$newEGID, env: $envdebug"
</span> }
ui_debug $cmd
catch {system -W $dir $cmd} result options
if {[getuid] == 0} {
seteuid $oldEUID
setegid $oldEGID
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set env(HOME) $oldHOME
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "euid/egid restored to: $oldEUID/$oldEGID, HOME restored to: $oldHOME"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array unset env *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set env [array get oldEnv]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "euid/egid restored to: $oldEUID/$oldEGID, env restored"
</span> }
return -options $options $result
}
</pre><pre style='margin:0'>
</pre>