This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

1.7.9: g_spawn with envp set doesn't see my envp unless it's setting PATH


I have code that calls g_spawn_sync and sets an environment variable.  The program that I am spawning simply dumps out the environment and exits.  I found some odd behavior when running this test app on Cygwin, if I set any random variable, like "HELLO=world" it is not passed to the child.  However, if I set PATH, I get it set along with 2 other variables.  Attached is my test code that demonstrates the issue.

Environ.c - child program that dumps the environment
Gspawn_env_test.cpp - program that spawns environ.c and reads the output
Make - simple shell script that builds the test apps

Cygwin 1.7.9 results:

$ ./gspawn_env_test.exe
** (process:5080): DEBUG: Calling my_environ with envp set to HELLO=world
** (process:5080): DEBUG: result:

** (process:5080): DEBUG: ------------------------------------
** (process:5080): DEBUG: Calling my_environ with envp set to PATH=/usr/bin
** (process:5080): DEBUG: result:
PATH=/usr/bin
SYSTEMROOT=C:\Windows
WINDIR=C:\Windows

** (process:5080): DEBUG: ------------------------------------

Ubuntu 10.04 results:

[mfisch@toaster ~/gspawn_issue]$ ./gspawn_env_test
** (process:29580): DEBUG: Calling my_environ with envp set to HELLO=world
** (process:29580): DEBUG: result:
HELLO=world

** (process:29580): DEBUG: ------------------------------------
** (process:29580): DEBUG: Calling my_environ with envp set to PATH=/usr/bin
** (process:29580): DEBUG: result:
PATH=/usr/bin

** (process:29580): DEBUG: ------------------------------------

Attachment: cygcheck.out
Description: cygcheck.out

Attachment: environ.c
Description: environ.c

Attachment: gspawn_env_test.cpp
Description: gspawn_env_test.cpp

Attachment: make
Description: make

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]