diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2022-09-05 15:25:58 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2022-09-05 15:25:58 (GMT) |
| commit | c7522c3f9382fe7e2e85bed01556d590a2f43757 (patch) | |
| tree | ae3953f0883f343923a56e3df1576f51d6624055 | |
| parent | 6a866ef98badfbed29a17955fad2767891fe7d10 (diff) | |
| parent | 57807a30bb766ff5e18b94270ac3d92041b006af (diff) | |
| download | tcl-c7522c3f9382fe7e2e85bed01556d590a2f43757.zip tcl-c7522c3f9382fe7e2e85bed01556d590a2f43757.tar.gz tcl-c7522c3f9382fe7e2e85bed01556d590a2f43757.tar.bz2 | |
Merge 8.7. Primarily ticket [55a02f20ec]
| -rw-r--r-- | tests/env.test | 40 | ||||
| -rw-r--r-- | unix/tclUnixSock.c | 4 | ||||
| -rw-r--r-- | win/tclWinInit.c | 9 | ||||
| -rw-r--r-- | win/tclWinSock.c | 8 |
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 f413b5b..e7c9458 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -431,7 +431,7 @@ TcpBlockModeProc( * * Side effects: * Processes socket events off the system queue. May process - * asynchroneous connects. + * asynchronous connects. * *---------------------------------------------------------------------- */ @@ -1348,7 +1348,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 bbb0c81..b7b5c0d 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -513,7 +513,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 2261ee2..8f763b4 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -584,8 +584,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. * *---------------------------------------------------------------------- */ @@ -1806,7 +1806,7 @@ TcpConnect( } /* - * For asynchroneous connect set the socket in nonblocking mode + * For asynchronous connect set the socket in nonblocking mode * and activate connect notification */ @@ -1921,7 +1921,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; |
