X-Spam-Check-By: sourceware.org Message-ID: <43EB6ECD.3060706@mscha.org> Date: Thu, 09 Feb 2006 17:33:17 +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: Patch for cygutils: let cygstart properly convert environment variables Content-Type: multipart/mixed; boundary="------------050500020707050105070606" 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 --------------050500020707050105070606 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Hi, Attached is a patch that fixes a bug in cygstart, triggered by changes in Cygwin 1.5.19, where certain path-based environment variables (like TMP) were not converted from POSIX to Win32. (See .) It also contains the outstanding patch from Eric Blake to not let cygstart parse any options listed after the to-be-started command. (See .) Chuck, can you please apply the patch, and release a new version, at your convenience? A suggested list of changes: * cygstart - properly convert environment variables to Win32 * cygstart - don't parse options listed after the command Thanks in advance, – Michael --------------050500020707050105070606 Content-Type: text/plain; name="cygstart_envconf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cygstart_envconf.patch" ? .cygstart.c.swp Index: cygstart.c =================================================================== RCS file: /cvs/cygwin-apps/cygutils/src/cygstart/cygstart.c,v retrieving revision 1.4 diff -u -r1.4 cygstart.c --- cygstart.c 16 May 2005 20:18:52 -0000 1.4 +++ cygstart.c 9 Feb 2006 16:30:56 -0000 @@ -40,7 +40,7 @@ #define MSDN_URL "http://msdn.microsoft.com/library/en-us/shellcc/platform/" \ "Shell/reference/functions/shellexecute.asp" -static const char versionID[] = "1.2"; +static const char versionID[] = "1.3"; /* for future CVS */ static const char revID[] = "$Id: cygstart.c,v 1.4 2005/05/16 20:18:52 cwilson Exp $"; @@ -176,7 +176,7 @@ } /* Parse options */ - optCon = poptGetContext(NULL, argc, argv, opt, 0); + optCon = poptGetContext(NULL, argc, argv, opt, POPT_CONTEXT_POSIXMEHARDER); poptSetOtherOptionHelp(optCon, "[OPTION]... FILE [ARGUMENTS]"); while ((rc = poptGetNextOpt(optCon)) > 0) { switch (rc) { @@ -523,6 +523,8 @@ char **envp = environ; char *var, *val; char curval[2]; + char *winpathlist; + char winpath[MAX_PATH+1]; while (envp && *envp) { var = strdup(*envp++); @@ -531,7 +533,25 @@ if (GetEnvironmentVariable(var, curval, 2) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { - SetEnvironmentVariable(var, val); + /* 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)+1); + 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); --------------050500020707050105070606 Content-Type: text/plain; charset=us-ascii -- 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/ --------------050500020707050105070606--