X-Spam-Check-By: sourceware.org X-BigFish: V Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: bash improperly sets PATH containing period Date: Wed, 4 Apr 2007 09:59:17 -0400 Message-ID: In-Reply-To: <46127E23.8030007@mff.cuni.cz> From: "Long, Phillip GOSS" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l34DxLLp012145 Pavel Kudrna wrote: > Hi, > when dos(win32) path contains period, e.g. "c:." bash instead of > converting to "/cygdrive/c" incorrectly copies > this string into PATH variable including colon! > (Such dos path containing period is legal and is used in Novell Client > as search drives.) > Pavel Kudrna > > C:\temp> path c:\temp;c:.;s:\public > > C:\temp> path > PATH=c:\temp;c:.;s:\public > > C:\temp> "C:\Program Files\cygwin\bin\bash.exe" --login -i > > kudrna AT k15 ~ > $ echo $PATH > /usr/X11R6/bin:/usr/local/bin:/usr/bin:/bin:/cygdrive/c/temp:c:.:/cygdri ve/s/public:/usr/local/cint I, too, ran into this problem, and it was also due to Novell, although I believed at the time that our IT department had done it. In my book, this is a bug on Novell's part, because the 'c:.' notation in Windows-land means 'current directory on the C: drive.' This is process-specific, for one thing; for another, as soon as a subprocess happens to go to that drive and change the current directory, the path is changed! This may not matter for the initial process upon login, which won't do be changing its CWD on any drives, but it can mess up other processes started later. I ended up writing a BASH script which invoked a GAWK script (probably could have combined the two) to fix the PATH variable. The latter script invoked a quickie BAT script to get the CWD on the Netware drive: REM This command is a NO-OP so that ERRORLEVEL is reset to ZERO. c:/WINNT/system32/attrib.exe . > nul if . == .%1 goto end cd %1 > nul if NOT errorlevel 1 %1 if NOT errorlevel 1 %cygwindir%/bin/pwd if . == .%2 goto end %SystemDrive% :end The element of the PATH was passed as %1; I believe I used %2 during testing so that I didn't change _my_ PATH. There was more involved than this (I can post the scripts if anybody is interested), but the idea is what's important: Use 'pwd' in a subprocess to print the actual directory on the Netware drive and resplace the bogus PATH element with the _real_ directory. -------------------------------------------------------- Goss ... Innovation for Business NOTICE: This e-mail and any attachment(s) may contain confidential and proprietary information of Goss International Corporation and/or its subsidiaries and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender. No contract may be construed by this e-mail. -- 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/