Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Subject: 1.3.5: error in inheriting new PATH To: cygwin AT cygwin DOT com X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: From: Heiko_Elger AT arburg DOT com Date: Tue, 20 Nov 2001 10:40:35 +0100 X-MIMETrack: Serialize by Router on HUB02/DE/SRV/ARBURG(Release 5.0.7 |March 21, 2001) at 20.11.2001 10:39:00 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Hello, I'm sorry to post the same problem as in http://sources.redhat.com/ml/cygwin/2001-11/msg00361.html again, but the answer I was given in http://sources.redhat.com/ml/cygwin/2001-11/msg00393.html could not be the solution! 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. If I set the path in the comandline of cmd.exe "set path=.....very long path" - all wokrs fine too!!!! - Why ??? 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. - I think this must be an old definition, cause I definitely can set a path longer than 260 characters. - I think this is general problem of cygwin - and not a application problem. Cause of this I post it here. I hope anyone can give me a hint to resolve my problem or perhaps find the bug in cygwin (if it is one). With MKS toolkit all works fine - but we do not want to use it MKS is too expensive and we think that the cygwin tools are the better one Please help .... Best regards Heiko Elger ----------------------- start changeenv.c -------------------- #include #include #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 #include 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/