diff options
author | sebres <sebres@users.sourceforge.net> | 2018-08-20 19:58:44 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2018-08-20 19:58:44 (GMT) |
commit | 01dd016ad89794ac85bfc2a7ccbedbb6d4c7f14f (patch) | |
tree | e3d9bb5897a4c169519b4048ee7407e7084c2d55 | |
parent | d660b325b58998ff0627e899550abf58bf260174 (diff) | |
download | tcl-01dd016ad89794ac85bfc2a7ccbedbb6d4c7f14f.zip tcl-01dd016ad89794ac85bfc2a7ccbedbb6d4c7f14f.tar.gz tcl-01dd016ad89794ac85bfc2a7ccbedbb6d4c7f14f.tar.bz2 |
because executable (1st argument) always proper escaped now, don't need to replace long path name of batch-executable with short path name (reduced to 16-bit applications only).
-rw-r--r-- | tests/winPipe.test | 44 | ||||
-rw-r--r-- | win/tclWinPipe.c | 2 |
2 files changed, 34 insertions, 12 deletions
diff --git a/tests/winPipe.test b/tests/winPipe.test index eb0a854..e817e85 100644 --- a/tests/winPipe.test +++ b/tests/winPipe.test @@ -310,21 +310,33 @@ test winpipe-6.2 {PipeSetupProc & PipeCheckProc: write threads} \ proc _testExecArgs {single args} { variable path - set path(echoArgs.tcl) [makeFile { - puts "[list [file tail $argv0] {*}$argv]" - } echoArgs.tcl] - set path(echoArgs.bat) [makeFile "@[file native [interpreter]] $path(echoArgs.tcl) %*" echoArgs.bat] + if {![info exists path(echoArgs.tcl)] || ![file exists $path(echoArgs.tcl)]} { + set path(echoArgs.tcl) [makeFile { + puts "[list [file tail $argv0] {*}$argv]" + } echoArgs.tcl] + } + if {![info exists path(echoArgs.bat)] || ![file exists $path(echoArgs.bat)]} { + set path(echoArgs.bat) [makeFile "@[file native [interpreter]] $path(echoArgs.tcl) %*" "echoArgs.bat"] + } + set cmds [list [list [interpreter] $path(echoArgs.tcl)]] + if {!($single & 2)} { + lappend cmds [list $path(echoArgs.bat)] + } else { + if {![info exists path(echoArgs2.bat)] || ![file exists $path(echoArgs2.bat)]} { + file mkdir [file join [temporaryDirectory] test(Dir)Check] + set path(echoArgs2.bat) [makeFile "@[file native [interpreter]] $path(echoArgs.tcl) %*" \ + "test(Dir)Check/echo(Cmd)Test Args & Batch.bat"] + } + lappend cmds [list $path(echoArgs2.bat)] + } set broken {} foreach args $args { - if {$single} { + if {$single & 1} { set args [list $args] } - foreach cmd [list \ - [list [interpreter] $path(echoArgs.tcl)] \ - [list $path(echoArgs.bat)] \ - ] { + foreach cmd $cmds { set e [list [file tail $path(echoArgs.tcl)] {*}$args] - tcltest::DebugPuts 4 " ## test exec [file extension [lindex $cmd 0]] for $e" + tcltest::DebugPuts 4 " ## test exec [file extension [lindex $cmd 0]] ($cmd) for\n ## $args" if {[catch { exec {*}$cmd {*}$args } r]} { @@ -475,6 +487,15 @@ test winpipe-8.3 {BuildCommandLine/parse_cmdline pass-thru: check injection on s [list "START\"" {*}$injectList "\"END"] } -result {} +test winpipe-8.4 {BuildCommandLine/parse_cmdline pass-thru: check injection on special meta-chars (command/jointly args)} \ +-constraints {win exec} -body { + _testExecArgs 2 \ + [list START {*}$injectList END] \ + [list "START\"" {*}$injectList END] \ + [list START {*}$injectList "\"END"] \ + [list "START\"" {*}$injectList "\"END"] +} -result {} + rename _testExecArgs {} # restore old values for env(TMP) and env(TEMP) @@ -487,6 +508,7 @@ if {[catch {set env(TEMP) $env_temp}]} { } # cleanup -file delete big little stdout stderr nothing echoArgs.tcl +file delete big little stdout stderr nothing echoArgs.tcl echoArgs.bat +file delete -force [file join [temporaryDirectory] test(Dir)Check] ::tcltest::cleanupTests return diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index cdbf467..a6a8f22 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1492,7 +1492,7 @@ ApplicationType( return APPL_NONE; } - if ((applType == APPL_DOS) || (applType == APPL_WIN3X)) { + if (applType == APPL_WIN3X) { /* * Replace long path name of executable with short path name for * 16-bit applications. Otherwise the application may not be able to |