Menu

#1808 problem with " in [exec] on windows

obsolete: 8.4a5
closed-invalid
None
5
2004-02-01
2002-03-11
No

% 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 {\\}
\\

Discussion

  • David Gravereaux

     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    changes to win/tclAppInit.c

     
  • David Gravereaux

    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!

     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
    • assigned_to: nobody --> hobbs
     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    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.

     
  • David Gravereaux

    Logged In: YES
    user_id=7549

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

     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    Logged In: YES
    user_id=7549

    I'm all confused about this. please test.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2002-04-23

    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?

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2002-04-23
    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    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.

     
  • David Gravereaux

    • summary: problem with " in [exec] on windows --> problem with " in [exec] on windows
     
  • David Gravereaux

    • assigned_to: hobbs --> davygrvy
     
  • David Gravereaux

    Logged In: YES
    user_id=7549

    This is bogus...

     
  • David Gravereaux

    • status: open --> closed-invalid