/bin/pwd, cygpath -wa fail under native symlink

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

/bin/pwd, cygpath -wa fail under native symlink

Ernie Rael
(CYGWIN_NT-6.1 spirit 3.1.1(0.340/5/3) 2019-12-18 09:28 x86_64 Cygwin, win7)

The windows root is C:, cygwin root is on F:.
A native symlink under C: that points into F: gets
an incorrect result from cygpath -wa.

Notice that when the current directory is the target of the symlink
then the result is ok. But any deeper in the tree fails. To summarize:

     @ /a/src/jvi-dev/jvi
$ cygpath -wa .
C:\f\src\jvi-dev\jvi <<<<<<< correct
     @ /a/src/jvi-dev/jvi/src
$ cygpath -wa .
C:\a\src\jvi-dev\jvi\src <<<<<<< fail

=== more detail ===

     @ /a/src/jvi-dev
$ ls -l jvi
lrwxrwxrwx 1 erra None 18 Dec 23 15:16 jvi -> /f/src/jvi-dev/jvi

     @ /a/src/jvi-dev
$ junction jvi

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

C:\a\src\jvi-dev\jvi: SYMBOLIC LINK
    Print Name     : C:\f\src\jvi-dev\jvi
    Substitute Name: \??\C:\f\src\jvi-dev\jvi

     @ /a/src/jvi-dev
$ cygpath -wa jvi
C:\a\src\jvi-dev\jvi

     @ /a/src/jvi-dev
$ cd jvi

     @ /a/src/jvi-dev/jvi
$ cygpath -wa .
C:\f\src\jvi-dev\jvi <<<<<<< correct

     @ /a/src/jvi-dev/jvi
$ cd src

     @ /a/src/jvi-dev/jvi/src
$ cygpath -wa .
C:\a\src\jvi-dev\jvi\src <<<<<<< fail

=== some possibly relevent stuff from the mount table

$ mount
F:/cygwin64 on / type ntfs (binary,auto)
C:/f on /f type ntfs (binary,user)
F:/c on /c type ntfs (binary,user)
F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto)


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

Reply | Threaded
Open this post in threaded view
|

How to get the drive a file is on (was Re: /bin/pwd, cygpath -wa fail under native symlink)

Ernie Rael
I need to find out the drive on which some files reside.

I need to make some links from a tmp dir to the files from a script. So
I need to determine where they reside so I can figure out which tmp dir
to use. Hard links, not running as administrator.

I tried cygpath -wa and /bin/pwd. They fail in some cases as described
below. If this is a problem for cygwin, is there a win7 command I can use?

-ernie

On 12/25/2019 2:05 PM, Ernie Rael wrote:

> (CYGWIN_NT-6.1 spirit 3.1.1(0.340/5/3) 2019-12-18 09:28 x86_64 Cygwin,
> win7)
>
> The windows root is C:, cygwin root is on F:.
> A native symlink under C: that points into F: gets
> an incorrect result from cygpath -wa.
>
> Notice that when the current directory is the target of the symlink
> then the result is ok. But any deeper in the tree fails. To summarize:
>
>     @ /a/src/jvi-dev/jvi
> $ cygpath -wa .
> C:\f\src\jvi-dev\jvi <<<<<<< correct
>     @ /a/src/jvi-dev/jvi/src
> $ cygpath -wa .
> C:\a\src\jvi-dev\jvi\src <<<<<<< fail
>
> === more detail ===
>
>     @ /a/src/jvi-dev
> $ ls -l jvi
> lrwxrwxrwx 1 erra None 18 Dec 23 15:16 jvi -> /f/src/jvi-dev/jvi
>
>     @ /a/src/jvi-dev
> $ junction jvi
>
> Junction v1.06 - Windows junction creator and reparse point viewer
> Copyright (C) 2000-2010 Mark Russinovich
> Sysinternals - www.sysinternals.com
>
> C:\a\src\jvi-dev\jvi: SYMBOLIC LINK
>    Print Name     : C:\f\src\jvi-dev\jvi
>    Substitute Name: \??\C:\f\src\jvi-dev\jvi
>
>     @ /a/src/jvi-dev
> $ cygpath -wa jvi
> C:\a\src\jvi-dev\jvi
>
>     @ /a/src/jvi-dev
> $ cd jvi
>
>     @ /a/src/jvi-dev/jvi
> $ cygpath -wa .
> C:\f\src\jvi-dev\jvi <<<<<<< correct
>
>     @ /a/src/jvi-dev/jvi
> $ cd src
>
>     @ /a/src/jvi-dev/jvi/src
> $ cygpath -wa .
> C:\a\src\jvi-dev\jvi\src <<<<<<< fail
>
> === some possibly relevent stuff from the mount table
>
> $ mount
> F:/cygwin64 on / type ntfs (binary,auto)
> C:/f on /f type ntfs (binary,user)
> F:/c on /c type ntfs (binary,user)
> F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto)
>
>
> --
> 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