X-Spam-Check-By: sourceware.org Message-ID: <43EA2F23.7030805@mscha.org> Date: Wed, 08 Feb 2006 18:49:23 +0100 From: Michael Schaap Reply-To: cygwin AT cygwin DOT com User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: strange cygstart bug with current Cygwin versions References: <2fc802c00602031305p7574f255g5e67e44cd8b754e AT mail DOT gmail DOT com> <2fc802c00602061329x56784831mb5ab16a12191b2e AT mail DOT gmail DOT com> <43E7D056 DOT 10505 AT mscha DOT org> <20060207023104 DOT GA2484 AT efn DOT org> <43E8E00F DOT 2060903 AT mscha DOT org> <20060207180238 DOT GA18679 AT trixie DOT casa DOT cgf DOT cx> <20060208154122 DOT GB20952 AT trixie DOT casa DOT cgf DOT cx> In-Reply-To: <20060208154122.GB20952@trixie.casa.cgf.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 8-Feb-2006 16:41, Christopher Faylor wrote: > On Tue, Feb 07, 2006 at 01:25:12PM -0600, Brian Ford wrote: > >> On Tue, 7 Feb 2006, Christopher Faylor wrote: >> >> >>> I believe that Brian Ford is looking into modifying the new CW_SETUP_WINENV >>> code to perform the proper conversion of POSIX style to Windows style. >>> >> We're still debating aproaches for solving our problem, so it is possible >> I won't get to it. If someone else wants to try, feel free. >> > > Well, that's disappointing. I'm not aware of any debates. I thought > just this once we could rely on someone else fixing a problem. > > I guess I'll look into this when I get a chance. > > Well, the below code works for cygstart, and does the right thing for the variables Cygwin converts from POSIX <-> Win32. Feel free to adapt this to CW_SETUP_WINENV. (Although it might be more elegant to use conv_envvars[] from environ.cc there.) If I hear no objections, I'm going to submit this as a path for cygutils, and ask Chuck to release it. If and when this gets fixed in CW_SETUP_WINENV, and released, I'll change it to use that instead. – Michael /* Copy cygwin environment variables to the Windows environment if they're not * already there. */ static void setup_win_environ(void) { char **envp = environ; char *var, *val; char curval[2]; char *winpathlist; char winpath[MAX_PATH+1]; while (envp && *envp) { var = strdup(*envp++); val = strchr(var, '='); *val++ = '\0'; if (GetEnvironmentVariable(var, curval, 2) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { /* Convert POSIX to Win32 where necessary */ if (!strcmp(var, "PATH") || !strcmp(var, "LD_LIBRARY_PATH")) { winpathlist = (char *) malloc(cygwin_posix_to_win32_path_list_buf_size(val)); if (winpathlist) { cygwin_posix_to_win32_path_list(val, winpathlist); SetEnvironmentVariable(var, winpathlist); free(winpathlist); } } else if (!strcmp(var, "HOME") || !strcmp(var, "TMPDIR") || !strcmp(var, "TMP") || !strcmp(var, "TEMP")) { cygwin_conv_to_win32_path(val, winpath); SetEnvironmentVariable(var, winpath); } else { SetEnvironmentVariable(var, val); } } free(var); } } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/