This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: /bin/pwd -P doesn't expand all symlinks
- From: Mark O'Keefe <mark_okeefe at mac dot com>
- To: "Nellis, Kenneth" <Kenneth dot Nellis at xerox dot com>
- Cc: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Sat, 24 Oct 2015 00:10:47 +1100
- Subject: Re: /bin/pwd -P doesn't expand all symlinks
- Authentication-results: sourceware.org; auth=none
- References: <A209F3EB-2FC6-42AB-A4E0-B5A88C53DF4A at mac dot com> <0D835E9B9CD07F40A48423F80D3B5A702E93D1BA at USA7109MB022 dot na dot xerox dot net>
Thanks Ken, you gave me an idea.
$ uname -srvmo
CYGWIN_NT-6.3 2.3.0(0.290/5/3) 2015-09-08 22:33 x86_64 Cygwin
I'm using native symlinks for compatibility. Turns out that if you use the below option to create the symlink you get the behavior I'm seeing. If you don't use this it works correctly. Guess the issue is in understanding native symlinks... Is that expected? I know I don't like it ;-)
CYGWIN=winsymlinks:nativestrict
Cheers,
Mark.
On 23 Oct 2015, at 11:35 PM, Nellis, Kenneth <Kenneth.Nellis@xerox.com> wrote:
>> From: Mark O'Keefe
>>
>> Hi,
>>
>> 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.
>>
>> Cheers,
>> Mark.
>
> FWIW, WJJFM:
>
> $ cd /tmp
> $ /bin/pwd -P
> /tmp
> $ ln -s /home .
> $ cd home
> /tmp/home
> $ /bin/pwd -P
> /home
> $ pwd
> /tmp/home
> $ mkdir dummy
> $ cd dummy
> /tmp/home/dummy
> $ pwd
> /tmp/home/dummy
> $ /bin/pwd -P
> /home/dummy
> $ uname -srvmo
> CYGWIN_NT-6.1 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64 Cygwin
> $
>
> --Ken Nellis
>
> --
> 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
>
--
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