public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Houder <houder@xs4all.nl>
To: cygwin@cygwin.com
Subject: Re: antrun versus wsl versus cygwin
Date: Tue, 19 Feb 2019 10:31:00 -0000	[thread overview]
Message-ID: <ace4deb7780df96784a30781b03b9416@smtp-cloud9.xs4all.net> (raw)
In-Reply-To: <q4e7k5$5mhm$1@blaine.gmane.org>

On Mon, 18 Feb 2019 13:15:02, Franz Fehringer  wrote:

> Am 18.02.2019 um 11:42 schrieb Houder:
[snip]

> > Now show us the output of an antrun script, where the executable
> > is C:\Tools\Cygwin\bin\which and its argument: bash
> 
> <exec executable="C:\Tools\Cygwin\bin\which" failonerror="true">
>   <arg line="bash" />
> </exec>
> <exec executable="bash" failonerror="true">
>   <arg line="-c src/main/resources/build" />
> </exec>
> 
> gives
> 
> [exec] /usr/bin/bash
> [exec] W i n d o w s   S u b s y s t e m   f o r   L i n u x   h a s   n
> o   i n s t a l l e d   d i s t r i b u ti o n s .
> [exec]    D i s t r i b u t i o n s   c a n   b e   i n s t a l l e d
> b y   v i s i t i n g   t h e   M i c r o s o f t   S t o r e :
> [exec]    h t t p s : / / a k a . m s / w s l s t o r e
> 
> It is as if C:\Windows\System32 were hardcoded somewhere
> The ant exec documentation says
> "The <exec> task delegates to Runtime.exec which in turn apparently
> calls ::CreateProcess. It is the latter Win32 function that defines the
> exact semantics of the call. "

Erm, thinking this over ... you may be on the right track ...

After invoking the Windows executable (JVM or whatever) from Cygwin, "bash"
is started using CreateProcess()

    https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessa

Before it searches PATH, CreateProcess checks "the 32-bit Windows system
directory" for the presence of "bash.exe".

And we know that bash.exe from WSL is present in C:\Windows\System32. That
does explain why the output of bash from WSL is shown, does it not?
(reporting that a distribution is still to be installed).

The above also explains why renaming bash from WSL to "wslbash.exe" forces
CreateProcess() to search for the presence of bash.exe down the PATH.

Henri


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2019-02-18 23:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-17 12:53 Franz Fehringer
2019-02-17 13:39 ` Thomas Wolff
2019-02-17 14:14   ` Franz Fehringer
2019-02-18 20:54     ` Thomas Wolff
2019-02-17 14:46 ` LRN
2019-02-18  9:25   ` Franz Fehringer
2019-02-17 15:35 ` Houder
2019-02-18  8:28   ` Franz Fehringer
2019-02-17 22:10 ` Csaba Ráduly
2019-02-17 23:05   ` Franz Fehringer
2019-02-18  3:08     ` Andrey Repin
2019-02-18  7:20       ` Franz Fehringer
2019-02-18  9:40       ` Franz Fehringer
2019-02-18 10:58         ` Houder
2019-02-18 12:59           ` Franz Fehringer
2019-02-18 13:16             ` Houder
2019-02-18 14:11               ` Franz Fehringer
2019-02-18 17:06                 ` Houder
2019-02-18 17:10                   ` Franz Fehringer
2019-02-18 20:52                   ` Franz Fehringer
2019-02-19 10:31             ` Houder [this message]
2019-02-19 19:15               ` Franz Fehringer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ace4deb7780df96784a30781b03b9416@smtp-cloud9.xs4all.net \
    --to=houder@xs4all.nl \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).