delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/09/11:06:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.2.0.9.2.20030209080135.02d48f88@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Sun, 09 Feb 2003 08:05:15 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: cygwin symlink? bug
In-Reply-To: <010401c2d041$e76060e0$78d96f83@pomello>
References: <000901c2d022$869cbe80$0200a8c0 AT ufo>
Mime-Version: 1.0

Max, Trevor,

BASH keeps an internal idea of the current working directory. In the 
face of symbolic links, this internal record of the current working 
directory may not be identical to that computed by the "pwd" programs 
traversal-to-root algorithm.

I use this instead of BASH's built-in pwd command:

wd() {
     WD="$(pwd)"
     WDP="$(/bin/pwd)"
     if [ "$WD" != "$WDP" ]; then
         echo "bash: $WD"$'\n'"real: $WDP"
     else
         echo "$WD"
     fi
}

I use this one if I want to see the Windows form of the current working 
directory, too:

awd() {
     WD="$(pwd)"
     WDP="$(/bin/pwd)"
     if [ "$WD" != "$WDP" ]; then
         echo "bash: $WD"$'\n'"cyg:  $WDP"
     else
         echo "cyg:  $WD"
     fi
     echo "win:  $(cygpath -w -a "$(pwd)")"
     echo "mix:  $(cygpath -m -a "$(pwd)")"
}

Randall Schulz


At 05:48 2003-02-09, Max Bowsher wrote:
>Trevor Forbes wrote:
> > I am having problem with some of my build scripts and the following
> > demonstrates the problem:
> >
> > If run the following (as a script) I get -- /tmp/foo/bar
> > # !/bin/bash
>
>Are you sure? I can reproduce your results only if I change the shebang to
>/bin/sh.
>
> > cd /tmp; mkdir -p foo/bar; ln -f -s foo/bar bar; cd bar; pwd; cd ..
> >
> > If I type the line in a shell then I get what I expected -- /tmp/bar
> >
> > I am using cygwin-1.3.20-1 but do not I think it is a new feature.
> >
> > Is my logic correct?
>
>IIRC, Linux does this too - but I'm not easily able to test that at the
>moment.
>
>
>Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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