This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: bash improperly sets PATH containing period


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]