Skip to content

Commit

Permalink
Merge 8.6. Primarily ticket [55a02f20ec]
Browse files Browse the repository at this point in the history
  • Loading branch information
apnadkarni committed Sep 5, 2022
2 parents 59a5ff6 + 8c3f6e1 commit f5a64cd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
40 changes: 39 additions & 1 deletion tests/env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]] {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {}
Expand Down
4 changes: 2 additions & 2 deletions unix/tclUnixSock.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ TcpBlockModeProc(
*
* Side effects:
* Processes socket events off the system queue. May process
* asynchroneous connects.
* asynchronous connects.
*
*----------------------------------------------------------------------
*/
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion win/tclWinInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions win/tclWinSock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
*----------------------------------------------------------------------
*/
Expand Down Expand Up @@ -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
*/

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f5a64cd

Please sign in to comment.