diff --git a/doc/tclvars.n b/doc/tclvars.n index 9c76a5b56fe..ba7d46b827e 100644 --- a/doc/tclvars.n +++ b/doc/tclvars.n @@ -31,6 +31,10 @@ the parent directory of \fBtcl_library\fR, the directories listed in the \fBtcl_pkgPath\fR variable. Additional locations to look for files and package indices should normally be added to this variable using \fBlappend\fR. +Initialization of auto_path from the TCLLIBPATH environment +variable undergoes tilde substitution (see \fBfilename\fR) on each +path. Any tilde substitution that fails because the user is unknown +will be omitted from auto_path. .RS .PP Additional variables relating to package management exist. More diff --git a/doc/tm.n b/doc/tm.n index b97a8791f31..6bb1ac345a6 100644 --- a/doc/tm.n +++ b/doc/tm.n @@ -300,6 +300,10 @@ environment variables: \fB$::env(TCL8.1_TM_PATH)\fR \fB$::env(TCL8_1_TM_PATH)\fR \fB$::env(TCL8.0_TM_PATH)\fR \fB$::env(TCL8_0_TM_PATH)\fR .CE +.PP +Paths initialized from the environment variables undergo tilde +substitution (see \fBfilename\fR). Any path whose tilde substitution +fails because the user is unknown will be omitted from search paths. .SH "SEE ALSO" package(n), Tcl Improvement Proposal #189 .QW "\fITcl Modules\fR" diff --git a/library/init.tcl b/library/init.tcl index 09a02adb012..fc61ae37cb7 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -43,7 +43,15 @@ package require -exact tcl 8.7b1 if {![info exists auto_path]} { if {[info exists env(TCLLIBPATH)] && (![interp issafe])} { - set auto_path $env(TCLLIBPATH) + set auto_path [apply {{} { + lmap path $::env(TCLLIBPATH) { + # Paths relative to unresolvable home dirs are ignored + if {[catch {file tildeexpand $path} expanded_path]} { + continue + } + set expanded_path + } + }}] } else { set auto_path "" }