delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/10/23/11:05:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=GZ8PkZ37LdVQu5BP
STp3rfO4bLe25ITdGkuFNzw4u7PHlZ2Xb73echla1dLfTqXV9vMQyPzUleJVPsPh
KI5nmgGhHVcyDjMgl4CnNd0OsihznJuptFQJpPHby29Hl14fuqoNMyJPX4bQCfxX
4nimeV947xnLaHWjGGR5vGEBeXU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=48EwTMcCFvTNj50lbGCeN4
wWB/I=; b=W3/KIqxdIvKU5ADaXV7ZRUih0qySLdBTpxo0fppxJE+iqdWaCzfRuo
Poi0kbVmMGVPrIVysYXCzcq2qR4H+XRlUkz8HFSx6HVa1mD5ZUL2lcz9IAbsugyL
kVsgEUO6Np5mlQTUJag0/qb1jGBA0XII2MlN79c1ziOKJWvncUGJ0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=4.1 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Fri, 23 Oct 2015 17:53:17 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <854501859.20151023175317@yandex.ru>
To: "Mark O'Keefe" <mark_okeefe AT mac DOT com>, cygwin AT cygwin DOT com
Subject: Re: BUG: /bin/pwd -P doesn't expand all symlinks
In-Reply-To: <A209F3EB-2FC6-42AB-A4E0-B5A88C53DF4A@mac.com>
References: <A209F3EB-2FC6-42AB-A4E0-B5A88C53DF4A AT mac DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Mark O'Keefe!

> While using /bin/pwd -P to expand directories to get the absolute,
> non-symlinked version of the directory I discovered that this doesn't work
> on Cygwin as I believe it is meant to work.


> $ cd /tmp
> $ /bin/pwd -P
> /tmp
> $ ln -s /home .
> $ cd home
> $ /bin/pwd -P
> /home
> $ pwd
> /tmp/home
> $ mkdir dummy
> $ cd dummy
> $ pwd
> /tmp/home/dummy
> $ /bin/pwd -P
> /tmp/home/dummy

> NOTE:  That last command should have returned "/home/dummy".  It hasn't
> expanded the parent symbolic link as you would have expected it to do.

> For what I'm doing I need the physical path, not the symbolic path (which is what the -P is meant to provide).

> Please confirm if I'm correct in my understanding?  I've tested this on
> Ubuntu and it works as I'd expect it...

> Now having to create an alternative approach to get the correct answer
> while I wait for this to be fixed (assuming it is a bug as I believe it is).

> Thanks in advance for any help in resolving this.

There's some juju with native symlink expansion going on. I vaguely recall
that it was done for speed. But the results really seems non-expected.

C:\arc is a symlink to the \\daemon1\arc shared directory.

$ cd /c/arc/
anrdaemon AT daemon2:/c/arc
$ /bin/pwd.exe -P
//DAEMON1/arc
anrdaemon AT daemon2:/c/arc
$ /bin/readlink.exe -fe .
//DAEMON1/arc

All is well.

anrdaemon AT daemon2:/c/arc
$ cd images/
anrdaemon AT daemon2:/c/arc/images
$ /bin/pwd.exe -P
/c/arc/images
anrdaemon AT daemon2:/c/arc/images
$ readlink -fe .
/c/arc/images

Not expected. But here we are going to real surprise:

anrdaemon AT daemon2:/c/arc/images
$ readlink -fe $(pwd)
//DAEMON1/arc/images


-- 
With best regards,
Andrey Repin
Friday, October 23, 2015 17:46:32

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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