delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/04/04/09:59:33

X-Spam-Check-By: sourceware.org
X-BigFish: V
MIME-Version: 1.0
Subject: RE: bash improperly sets PATH containing period
Date: Wed, 4 Apr 2007 09:59:17 -0400
Message-ID: <CA77FC40E7A2D24695CF3C790BB73185BF0E96@DOVMS10001.goss.gossinternational.com>
In-Reply-To: <46127E23.8030007@mff.cuni.cz>
From: "Long, Phillip GOSS" <Phillip DOT Long AT gossinternational DOT com>
To: <cygwin AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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/


- Raw text -


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