Skip to content
Tcl Source Code View Ticket
Login

View Ticket

problem with " in [exec] on windows

Closed / Invalid528669ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 23 years ago
Descriptionplain2002-03-11 21:12:54
% 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 {\\}
\\
davygrvyplain2002-03-12 04:12:54
File Added - 19187: patch.txt
davygrvyplain2002-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 Ticket [528669ffff]: 2 changes [History diff]2002-03-12 05:12:10
davygrvyplain2002-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.
davygrvyplain2002-03-12 06:35:36
Logged In: YES 
user_id=7549

The previous example of calling [exec] was flawed!  please 
ignore my error.
davygrvyplain2002-03-12 06:43:52
Logged In: YES 
user_id=7549

I'm all confused about this.  please test.
hobbsplain2002-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?
davygrvyplain2002-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.
davygrvy Ticket [528669ffff]: 1 change [History diff]2004-01-29 07:46:10
davygrvyplain2004-02-01 16:27:15
Logged In: YES 
user_id=7549

This is bogus...
Log in (anonymous is fine) to add a comment.

Attachments: