Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!goblin1!goblin.stu.neva.ru!news.astraweb.com!border2.a.newsrouter.astraweb.com!border1.hitnews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 25 Apr 2013 03:03:54 -0500 From: "Chris Uppal" Newsgroups: comp.lang.java.programmer References: Subject: Re: exec problem is JDK 1.7.0_21 Date: Thu, 25 Apr 2013 09:02:53 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-RFC2646: Format=Flowed; Original Message-ID: Lines: 34 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-5f8i2hT0qT6L/gxLi3kICEGrH1THXJcnt2AvAv4N/FHoQPqEuSOV32K10RxNvhWVByDnyvKwwgPxpf+!h52Z4uP9/G6vHqYBP69w3Z9dqMce/sYS5y3u0PfO0fukWpXtcGYlXmYv3ZpOy3DhqPs4rCXi2Uo= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3101 Xref: csiph.com comp.lang.java.programmer:23639 Steven Simpson wrote: > Cross-compiled with mingw32: ... > int main(void) What is doing the argument splitting here, and where is its spec ? Point is that when you start an executable on Windows /you do not pass an array of strings/ to the OS. You pass a single string (or rather two strings -- one to name the executable and the other to be the /entire/ command line). That means that the interpretation of that (single) string as an array of sub-strings is /entirely/ at the target application's discretion. And hence entirely arbitrary. Arbitrary in practise I mean, not just in theory. (I have a micro-application in production that recognises quotes around its first argument but not around its second ;-) /Some/ applications use the built-in CommandLineToArgvW() function in Windows, but most (at least as far as my knowledge goes) do not. And anyway that function's defined behaviour defies belief (clearly the documentation simply enshrines the existing behaviour of some seriously stupid code). ProcessBuilder (if we take the code rather than the documentation as the spec) is a disgrace (if we just take the doc as the spec then it isn't even that). I have no idea what command-line parser mingw32 provides for (imposes on) the code it compiles. It /may/ be the same as CommandLineToArgvW() (or even be implemented using it), but my guess is that the mingw folk will have come up with something closer to what /bin/sh does in *nix. -- chris