Author JosephArmbruster
Recipients JosephArmbruster, astrand, christian.heimes, joearmbruster
Date 2007-11-20.12:11:14
SpamBayes Score 0.0103415
Marked as misclassified No
Message-id <>
I believe the issue lies with the cmd command line parameters and
insufficient quoting:

Currently, if this string is passed into CreateProcess as args, the call
will fail:

C:\WINDOWS\System32\cmd.exe /c "C:\Documents and
Settings\joe\Desktop\Development\Python3k\dev\pcbuild9\python.exe" -c
"import sys
; print(sys.argv)" foo bar

For sanity, when I try to execute this from a command prompt manually, I
noticed this behavior:

C:\Documents and Settings\joe>C:\WINDOWS\System32\cmd.exe /c
"C:\Documents and Settings\joe\Desktop\Development\Python3k\dev\pcbui
ld9\python.exe" -c "import sys; print(sys.argv)" foo bar
'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.

I read through cmd.exe and it is has this note:

If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:

1.  If all of the following conditions are met, then quote characters
    on the command line are preserved:

    - no /S switch
    - exactly two quote characters
    - no special characters between the two quote characters,
      where special is one of: &<>()@^|
    - there are one or more whitespace characters between the
      the two quote characters
    - the string between the two quote characters is the name
      of an executable file.

2.  Otherwise, old behavior is to see if the first character is
    a quote character and if so, strip the leading character and
    remove the last quote character on the command line, preserving
    any text after the last quote character.

I believe args falls under section 2.
Date User Action Args
2007-11-20 12:11:15JosephArmbrustersetspambayes_score: 0.0103415 -> 0.0103415
recipients: + JosephArmbruster, astrand, joearmbruster, christian.heimes
2007-11-20 12:11:15JosephArmbrustersetspambayes_score: 0.0103415 -> 0.0103415
messageid: <>
2007-11-20 12:11:14JosephArmbrusterlinkissue1475 messages
2007-11-20 12:11:14JosephArmbrustercreate