public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* BUG:  /bin/pwd -P doesn't expand all symlinks
@ 2015-10-23  4:47 Mark O'Keefe
  2015-10-23 14:02 ` Nellis, Kenneth
  2015-10-23 21:27 ` BUG: " Andrey Repin
  0 siblings, 2 replies; 4+ messages in thread
From: Mark O'Keefe @ 2015-10-23  4:47 UTC (permalink / raw)
  To: cygwin

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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE:  /bin/pwd -P doesn't expand all symlinks
  2015-10-23  4:47 BUG: /bin/pwd -P doesn't expand all symlinks Mark O'Keefe
@ 2015-10-23 14:02 ` Nellis, Kenneth
  2015-10-23 14:52   ` Mark O'Keefe
  2015-10-23 21:27 ` BUG: " Andrey Repin
  1 sibling, 1 reply; 4+ messages in thread
From: Nellis, Kenneth @ 2015-10-23 14:02 UTC (permalink / raw)
  To: cygwin

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: /bin/pwd -P doesn't expand all symlinks
  2015-10-23 14:02 ` Nellis, Kenneth
@ 2015-10-23 14:52   ` Mark O'Keefe
  0 siblings, 0 replies; 4+ messages in thread
From: Mark O'Keefe @ 2015-10-23 14:52 UTC (permalink / raw)
  To: Nellis, Kenneth; +Cc: cygwin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG:  /bin/pwd -P doesn't expand all symlinks
  2015-10-23  4:47 BUG: /bin/pwd -P doesn't expand all symlinks Mark O'Keefe
  2015-10-23 14:02 ` Nellis, Kenneth
@ 2015-10-23 21:27 ` Andrey Repin
  1 sibling, 0 replies; 4+ messages in thread
From: Andrey Repin @ 2015-10-23 21:27 UTC (permalink / raw)
  To: Mark O'Keefe, cygwin

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@daemon2:/c/arc
$ /bin/pwd.exe -P
//DAEMON1/arc
anrdaemon@daemon2:/c/arc
$ /bin/readlink.exe -fe .
//DAEMON1/arc

All is well.

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

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-23 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23  4:47 BUG: /bin/pwd -P doesn't expand all symlinks Mark O'Keefe
2015-10-23 14:02 ` Nellis, Kenneth
2015-10-23 14:52   ` Mark O'Keefe
2015-10-23 21:27 ` BUG: " Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).