summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2022-09-05 12:18:35 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2022-09-05 12:18:35 (GMT)
commit57807a30bb766ff5e18b94270ac3d92041b006af (patch)
treefd34480b0ef994873e28763b760b70eb782d3213
parent46cf6812fcfb415aae1696cf0b29cd2a6a77917a (diff)
parent1197ccadc0ba24b8f5dc9debc59ca25593067f64 (diff)
downloadtcl-57807a30bb766ff5e18b94270ac3d92041b006af.zip
tcl-57807a30bb766ff5e18b94270ac3d92041b006af.tar.gz
tcl-57807a30bb766ff5e18b94270ac3d92041b006af.tar.bz2
Merge 8.6. Primarily ticket [55a02f20ec]
-rw-r--r--tests/env.test40
-rw-r--r--unix/tclUnixSock.c4
-rw-r--r--win/tclWinInit.c9
-rw-r--r--win/tclWinSock.c8
4 files changed, 53 insertions, 8 deletions
diff --git a/tests/env.test b/tests/env.test
index 9eacd5d..89e2d04 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -107,6 +107,7 @@ variable keep {
CommonProgramFiles CommonProgramFiles(x86) ProgramFiles
ProgramFiles(x86) CommonProgramW6432 ProgramW6432
WINECONFIGDIR WINEDATADIR WINEDLLDIR0 WINEHOMEDIR PROCESSOR_ARCHITECTURE
+ USERPROFILE
}
variable printenvScript [makeFile [string map [list @keep@ [list $keep]] {
@@ -411,7 +412,7 @@ test env-7.3 {
return [info exists ::env(test7_3)]
}}
} -cleanup cleanup1 -result 1
-
+
test env-8.0 {
memory usage - valgrind does not report reachable memory
} -body {
@@ -421,6 +422,43 @@ test env-8.0 {
} -result {i'm with dummy}
+test env-9.0 {
+ Initialization of HOME from HOMEDRIVE and HOMEPATH
+} -constraints win -setup {
+ setup1
+ unset -nocomplain ::env(HOME)
+ set ::env(HOMEDRIVE) X:
+ set ::env(HOMEPATH) \\home\\path
+} -cleanup {
+ cleanup1
+} -body {
+ set pipe [open |[list [interpreter]] r+]
+ puts $pipe {puts $::env(HOME); flush stdout; exit}
+ flush $pipe
+ set result [gets $pipe]
+ close $pipe
+ set result
+} -result {X:\home\path}
+
+test env-9.1 {
+ Initialization of HOME from USERPROFILE
+} -constraints win -setup {
+ setup1
+ unset -nocomplain ::env(HOME)
+ unset -nocomplain ::env(HOMEDRIVE)
+ unset -nocomplain ::env(HOMEPATH)
+} -cleanup {
+ cleanup1
+} -body {
+ set pipe [open |[list [interpreter]] r+]
+ puts $pipe {puts $::env(HOME); flush stdout; exit}
+ flush $pipe
+ set result [gets $pipe]
+ close $pipe
+ set result
+} -result $::env(USERPROFILE)
+
+
# cleanup
rename getenv {}
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index d2068c3..b1dbdbc 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -434,7 +434,7 @@ TcpBlockModeProc(
*
* Side effects:
* Processes socket events off the system queue. May process
- * asynchroneous connects.
+ * asynchronous connects.
*
*----------------------------------------------------------------------
*/
@@ -1351,7 +1351,7 @@ TcpConnect(
}
/*
- * We need to forward the writable event that brought us here, bcasue
+ * We need to forward the writable event that brought us here, because
* upon reading of getsockopt(SO_ERROR), at least some OSes clear the
* writable state from the socket, and so a subsequent select() on
* behalf of a script level [fileevent] would not fire. It doesn't
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index fdeb0aa..8fa176b 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -527,7 +527,14 @@ TclpSetVariables(
Tcl_SetVar2(interp, "env", "HOME", Tcl_DStringValue(&ds),
TCL_GLOBAL_ONLY);
} else {
- Tcl_SetVar2(interp, "env", "HOME", "c:\\", TCL_GLOBAL_ONLY);
+ /* None of HOME, HOMEDRIVE, HOMEPATH exists. Try USERPROFILE */
+ ptr = Tcl_GetVar2(interp, "env", "USERPROFILE", TCL_GLOBAL_ONLY);
+ if (ptr != NULL && ptr[0]) {
+ Tcl_SetVar2(interp, "env", "HOME", ptr, TCL_GLOBAL_ONLY);
+ } else {
+ /* Last resort */
+ Tcl_SetVar2(interp, "env", "HOME", "c:\\", TCL_GLOBAL_ONLY);
+ }
}
}
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index e806423..2213fe2 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -588,8 +588,8 @@ TcpBlockModeProc(
* an error.
*
* Side effects:
- * Processes socket events off the system queue. May process
- * asynchroneous connect.
+ * Processes socket events off the system queue.
+ * May process asynchronous connect.
*
*----------------------------------------------------------------------
*/
@@ -1810,7 +1810,7 @@ TcpConnect(
}
/*
- * For asynchroneous connect set the socket in nonblocking mode
+ * For asynchronous connect set the socket in nonblocking mode
* and activate connect notification
*/
@@ -1925,7 +1925,7 @@ TcpConnect(
/*
* Clear the tsd socket list pointer if we did not wait for
- * the FD_CONNECT asynchroneously
+ * the FD_CONNECT asynchronously
*/
tsdPtr->pendingTcpState = NULL;