Fixing strace and cygcheck so that they work with mount -X

Michael Schaap cygwin@mscha.org
Wed May 11 23:43:00 GMT 2005


On 11-May-2005 20:58, David Rothenberger wrote:

> On 5/11/2005 9:53 AM, Christopher Faylor wrote:
>
>> On Wed, May 11, 2005 at 11:40:36AM -0400, Christopher Faylor wrote:
>>
>>> It sounds like you need to read MSDN on CreateProcess and see what
>>> it says
>>> about "lpEnvironment":
>>>
>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
>>>
>>
>
> cygstart uses ShellExecute, not CreateProcess.
>
>> Btw, from the description, it sounds like cygstart is broken right now
>> and could be fixed right now.  You don't need any of the functionality
>> from the snapshot.  You just need to construct a windows lpEnvironment
>> block from the UNIX-like global variable, provided by cygwin: "extern
>> char **environ".
>
>
> The attached patch fixes cygstart for me. It copies all missing Cygwin
> environment variables to the Windows environment before invoking
> ShellExecute.
>
Indeed, that's the help I needed!  :-)

The patch as-is doesn't compile for me, though, I presume because
    char **envp = (char **) cygwin_internal (CW_ENVP);
uses a not-yet-released Cygwin enhancement.  But when I change it to the
simpler and more standard
    char **envp = environ;
it compiles and works fine, both under mount -X and normally.

(At first I was a bit suspicious of the logic - it only sets those
Windows variables that are not currently set, so what about variables
that were changed or deleted within Cygwin? - but it looks like the
Windows environment isn't the standard pre-Cygwin user environment, but
a minimal one with only PATH and SYSTEMROOT set, so it actually does
behave optimally this way - it sets all other variables when running
under mount -X, and sets nothing otherwise.)

Revised patch attached.  Can you try this out and see if it still works
for you?  If you confirm this, I'll resend the patch in a new, more
obviously titled thread, to attract Chuck's attention.  ;-)

Thanks for your and Chris' assistance,

 - Michael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygstart_winenv.patch
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050511/e2d48c00/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list