www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/07/17:07:12

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
Message-ID: <BF35D9C143BCCC4EB63181B67C9320C804DEB4@serv-075.icon-germany.local>
From: Heribert Dahms <heribert_dahms AT icon-scm DOT com>
To: Heiko_Elger AT arburg DOT com, "'Gerrit P. Haase'" <cygwin AT cygwin DOT com>
Subject: RE: 1.3.4: error in inheriting new PATH environment form WIN32 ex
ecutable to CYGWIN executable
Date: Wed, 7 Nov 2001 23:06:39 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Hi Heiko,

I've never used such a very long string constant on a single source line.
To check that it's not clipped by the (borland) compiler insert at top of
main:

printf("intended PATH: %s\n", long_path);

Bye, Heribert (heribert_dahms AT icon-scm DOT com)

> -----Original Message-----
> From:	Gerrit P. Haase [SMTP:gerrit AT familiehaase DOT de]
> Sent:	Wednesday, November 07, 2001 16:50
> To:	Heiko_Elger AT arburg DOT com
> Cc:	cygwin AT cygwin DOT com
> Subject:	Re: 1.3.4: error in inheriting new PATH environment form
> WIN32 executable to CYGWIN executable
> 
> Hallo Heiko,
> 
> 2001-11-07 16:10:14, du schriebst:
> 
> > 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.
> 
> Yes, I used borland cc, there it is also not ok.  Why not use gcc?
> 
> At first I have modified the sources a little:
> 
> > ----------------------- start changeenv.c --------------------
> #include <stdio.h>
> #include <stdlib.h>
> 
> #define CYGWIN_SHELL        "c:/cygwin/bin/sh"
> #define CYGWIN_PRINTPATH    "c:/cygwin/home/Gerrit/script/printpath_gcc"
> #define WIN32_PRINTPATH     "c:/cygwin/home/Gerrit/script/printpath_bcc"
> 
> char long_path[] =
> "PATH=/usr/bin:/1234567890123456789012345678901234567890123456789012345678
> 90123456789012345678901234567890123456789012345678901234567890123456789012
> 34567890123456789012345678901234567890123456789012345678901234567890123456
> 78901234567890123456789012345678901234567890/12345678901234567890123456789
> 01234567890123456789012345678901234567890123456789012345678901234567890123
> 45678901234567890123456789012345678901234567890123456789012345678901234567
> 8901234567890123456789012345678901234567890123456789012345678901234567890"
> ;
> 
> 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=\n%s\n", env_path == NULL ? "" : env_path);
>     if (system( CYGWIN_SHELL " -ic \"echo system CYGWIN SHELL PATH=\"") !=
> 0)
>         perror("system()");
>     if (system( CYGWIN_SHELL " -ic \"echo $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=\n%s\n", env_path == NULL ? "" : env_path);
> 
>     return rc;
> }
> > }----------------------- end printpath.c --------------------
> 
	[Heribert]  [test output snipped] 

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019