Tcl Source Code

View Ticket
Login
Ticket UUID: 528669
Title: problem with " in [exec] on windows
Type: Bug Version: obsolete: 8.4a5
Submitter: davygrvy Created on: 2002-03-11 21:12:54
Subsystem: None Assigned To: davygrvy
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-02-01 16:27:15
Resolution: Invalid Closed By: davygrvy
    Closed on: 2004-02-01 09:27:15
Description:
% exec cmd /c echo "
\"
% exec cmd /c echo a="b"
a=\"b\"

double quotes are getting a literal backslash placed 
in front of it.  This isn't a blind pass-through.  The 
attached patch seems to fix this.  It needs more 
testing.

% exec cmd /c echo a="b"
a="b"
% exec cmd /c echo "b"
b
% exec cmd /c echo "b a"
"b a"
% exec cmd /c echo a="b"as
a="b"as
% exec cmd /c echo \\
\
% exec cmd /c echo \\\\
\\
% exec cmd /c echo {\\\\}
\\\\
% exec cmd /c echo {\\}
\\
User Comments: davygrvy added on 2004-02-01 16:27:15:
Logged In: YES 
user_id=7549

This is bogus...

davygrvy added on 2002-05-31 05:08:04:
Logged In: YES 
user_id=7549

You can forget the tclAppInit.c change.  That's me trying to 
fix the unicode bug.  As Tcl_Main expects a dirty argv[], one 
can't send it unicode anyways.  Not even if 
GetCommandLineW is supported on all Win32 OSes.  Which 
it is, oddly enough.

Maybe we could split Tcl_Main into two commands where 
Tcl_Main does the native conversion up to unicode then calls 
(maybe) Tcl_MainUni that does all the work as before but argv
[] is an array of Tcl_UniChar pointers (??)

Yeah, this has nothing to do with the quote bug, though.

hobbs added on 2002-04-23 08:22:15:
Logged In: YES 
user_id=72656

why are these changes in tclAppInit.c expected to effected 
the command line process " handling?  Or are both patches 
expected to be added?

davygrvy added on 2002-03-12 06:43:52:
Logged In: YES 
user_id=7549

I'm all confused about this.  please test.

davygrvy added on 2002-03-12 06:35:36:
Logged In: YES 
user_id=7549

The previous example of calling [exec] was flawed!  please 
ignore my error.

davygrvy added on 2002-03-12 06:23:37:
Logged In: YES 
user_id=7549

running the output of BuildCommandLine thru setargv() I'm 
getting this error:

% test_passthru {a"b} {cd fg}
{ab cd} fg
%

If I change the logic to output the following:
% test_buildcmdline {a"b} {cd fg}
"a""b" "cd fg"
% test_passthru {a"b} {cd fg}
a\"b {cd fg}
% exec cmd /c echo {a"b} {cd fg}
a\"b "cd fg"
%

It essentially is still wrong calling an external process...
much thought required for this issue.

davygrvy added on 2002-03-12 05:11:51:

File Added - 19193: patch.txt

Logged In: YES 
user_id=7549

Just added my thoughts on setargv() from win/tclAppInit.c

I changed it to grab the unicode command line and convert 
it down to oem.  This partialy addresses the i18n bug, but 
Tcl_Main() still wants a dirty argv instead of clean utf-8, 
so this change doesn't do anything useful.

GetCommandLineW() is supported on *ALL* Win32 platforms!

davygrvy added on 2002-03-12 04:12:54:

File Added - 19187: patch.txt

Attachments: