This is the mail archive of the
mailing list for the Cygwin project.
Re: Issue with run.exe and PWD with spaces since last update (Cygwin 1.7.21)
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 17 Jul 2013 15:45:32 +0200
- Subject: Re: Issue with run.exe and PWD with spaces since last update (Cygwin 1.7.21)
- References: <295777180 dot 20130716202913 at mtu-net dot ru> <20130717125916 dot GB21347 at calimero dot vinschen dot de> <51E69DE2 dot 10008 at cwilson dot fastmail dot fm>
- Reply-to: cygwin at cygwin dot com
On Jul 17 09:36, Charles Wilson wrote:
> On 7/17/2013 8:59 AM, Corinna Vinschen wrote:
> >This never works, even in any other directory. It's the same problem
> >which disallows checkX to work, as reported in
> >The cause is an optimization when calling cygwin executables. So far,
> >Cygwin executables got their arguments via mmeory copy as well as via
> >the single-line cmdline argument of CreateProcess. We removed the
> >latter since it was never meant to work that way in the first place.
> >Unfortunately it turns out that run/run2/checkX are Cygwin executables
> >which don't have a main routine, but rather a WinMain routine. The
> >latter has a single cmdline argument, which is generated via
> >GetCommandLine(). But since Cygwin executables get no single-line
> >command line anymore, this stopped working.
> This is a pretty unusual situation. I don't know of any other tool
> -- except perhaps the old frankenstein half-cygwin-half-win32
> tclsh.exe and wish.exe -- that does this, outside of run, run2, and
> checkX. All of which are cygwin-specific (or, at least, cygwin +
> mingw specific).
> Could we add a new cygwin_internal routine that triggers the
> allocation, creation and return of a suitable single-line command?
> Then run & friends could do (pseudo-code):
> LPCSTR s = GetCommandLine()
> #ifdef __CYGWIN__
> if s empty
> s = (LPCSTR) cygwin_internal(CW_WIN32_COMMAND_LINE)
That should be unnecessary. The culprit here is the default main
routine in cygwin's libcmain.c, which calls WinMain if the executable
doesn't provide its own main.
It doesn't construct the single-line commandline from argv, but rather
it calls GetCommandLineÌ. This, obviously, creates an empty command line
So, the actual fix is to change libcmain's main() routine to create
WinMain's cmdline arg from argc/argv.
However, either way, you will have to rebuild run/run2 for both
architectures since libcmain.c is linked statically to the executable.
So, if we do it this way, we should probably upload a new Cygwin DLL
with the patched libcmain ASAP, so you can rebuild against the new
libcmain. Or, actually it would be better you would test this as soon
as we made the patch, *before* releasing a new Cygwin DLL.
Anyway, if we do it that way, let's hope no other tool is doing the
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple