| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Subject: | 1.3.4: error in inheriting new PATH environment form WIN32 executable to |
| CYGWIN executable | |
| To: | cygwin AT cygwin DOT com |
| X-Mailer: | Lotus Notes Release 5.0.5 September 22, 2000 |
| Message-ID: | <OF4C6A95E3.F945D816-ONC1256AFD.0048D132@lossburg.arburg.com> |
| From: | Heiko_Elger AT arburg DOT com |
| Date: | Wed, 7 Nov 2001 14:33:08 +0100 |
| X-MIMETrack: | Serialize by Router on HUB02/DE/SRV/ARBURG(Release 5.0.7 |March 21, 2001) at |
| 07.11.2001 14:32:25 | |
| MIME-Version: | 1.0 |
Hello,
I have the following problem:
If a MS WIN 32 program changes his environment PATH variable to a very long
value (over 270 characters) and than calling a CYGWIN program per system() call
the path inside the CYGWIN program is reset to NULL! If it calls a MS WIN 32
program all works fine.
We have this problem with clearmake in exporting a very long path and the shell
is the CYGWIN sh.exe.
I tried to reproduce it within a very small test.
I wrote two small programs (belwo you wil find the sourcecode):
changeenv.c --> MS WIN 32 program which change his PATH environment and calls
per system() the program "printpath"
printpath.c --> prints the PATH environment to stdout
changeenv.exe is compiled with Microsoft Visual Studio.
printpath.exe is compiled with MS Visual Studio and cygwin gcc
I hope anyone can reproduce this error and give me a hint to resolve may
problem.
Best regards
Heiko Elger
----------------------- start changeenv.c --------------------
#include <stdio.h>
#include <stdlib.h>
#define CYGWIN_SHELL "d:\\programme\\cygwin\\bin\\sh"
#define CYGWIN_PRINTPATH "d:\\msdev\\makenv\\printpath\\printpath"
#define WIN32_PRINTPATH "d:\\msdev\\makenv\\printpath\\Debug\\printpath"
char long_path[]
= "PATH=/usr/bin:/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
;
int main (int argc, char ** argv, char **env)
{
int rc=0;
char * env_path ;
if (putenv(long_path) == -1)
perror("putenv()");
env_path = getenv("PATH");
printf("NEW Path=%s\n", env_path == NULL ? "" : env_path);
if (system( CYGWIN_SHELL " -ic \"echo system CYGWIN SHELL PATH=$PATH\"") !=
0)
perror("system()");
printf("system CYGWIN printpath: "); fflush( stdout );
if (system( CYGWIN_PRINTPATH ) != 0)
perror("system()");
printf("system WIN32 printpath: "); fflush( stdout );
if (system( WIN32_PRINTPATH ) != 0)
perror("system()");
return rc;
}
----------------------- end changeenv.c --------------------
----------------------- start printpath.c --------------------
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv, char **env)
{
int rc=0;
char * env_path ;
env_path = getenv("PATH");
printf("Path=%s\n", env_path == NULL ? "" : env_path);
return rc;
}----------------------- end printpath.c --------------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |