[Patch] sync windows environment

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Patch] sync windows environment

Charles Wilson-8
When an (msys) application launches another program via exec() or
spawn(), it uses the msys implementation of those functions. These
implementations are smart, and can detect when the to-be-launched
application is a non-msys (that is, native w32) app, and translates all
the environment variables (like PATH, etc) from unix to win32 format.

However, if you have an (msys) application that launches another app via
the Windows CreateProcess API (like, for instance, run.exe or
cygstart.exe), then the launcher app needs to manually synchronize the
win32 environment with the msys environment -- and translate those env
vars.  The details of this task really belong inside msys, not in a
bunch of separate applications.  Cygwin added the CW_SYNC_WINENV
cygwin_internal function four years ago; the attached patch implements
it for MSYS.

The patch also (a) adds a few additional vars to MSYS's list of "make
sure these are always defined" variables, based on today's cygwin
implementation, (b) cleans up the implementation of cygwin_internal to
ensure that va_end() is always called, and sets errno to ENOSYS for bad
CW_ values.


2010.09.04  Charles Wilson  <...>

       * environ.cc (forced_winenv_vars): Ensure that HOMEDRIVE,
       HOMEPATH, PATH, USERDOMAIN, USERNAME, USERPROFILE, and WINDIR
       environment variables exist.
       * external.cc (sync_winenv): New function.
       (cygwin_internal): Ensure that va_arg is cleaned up before
       return. Set errno on bad call. Support new CW_SYNC_WINENV option.
       * include/cygwin/version.h: Bump API version number.
       * include/sys/cygwin.h: Define CW_SYNC_WINENV.

Ok to commit?

--
Chuck

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys

sync_winenv.patch (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] sync windows environment

Cesar Strauss-2
On 4/9/2010 23:10, Charles Wilson wrote:

>
> 2010.09.04  Charles Wilson<...>
>
>         * environ.cc (forced_winenv_vars): Ensure that HOMEDRIVE,
>         HOMEPATH, PATH, USERDOMAIN, USERNAME, USERPROFILE, and WINDIR
>         environment variables exist.
>         * external.cc (sync_winenv): New function.
>         (cygwin_internal): Ensure that va_arg is cleaned up before
>         return. Set errno on bad call. Support new CW_SYNC_WINENV option.
>         * include/cygwin/version.h: Bump API version number.
>         * include/sys/cygwin.h: Define CW_SYNC_WINENV.
>

Patch looks good, seems to build and run fine.

> Ok to commit?

OK, thanks.

version.h is at revision 1.18 right now, it seems you need to update
your CVS tree.

Thanks,
Cesar


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] sync windows environment

Charles Wilson-8
On 9/6/2010 9:59 PM, Cesar Strauss wrote:
>> Ok to commit?
>
> OK, thanks.
>
> version.h is at revision 1.18 right now, it seems you need to update
> your CVS tree.

Updated, merged, and committed.

--
Chuck

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys