public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* symbolic links to /cygdrive/X/xxx with capital letter X
@ 2020-06-12  7:06 Arthur Norman
  2020-06-12 11:03 ` Andrey Repin
  2020-06-30 11:14 ` Corinna Vinschen
  0 siblings, 2 replies; 6+ messages in thread
From: Arthur Norman @ 2020-06-12  7:06 UTC (permalink / raw)
  To: cygwin

This running on Windows 10 1909 and cygwin has been updated to the latest 
version. The effect was also visible on a freshly installed minimal cygwin 
put on an almost fresh Windows 10 VM.

Cygwin these days seems to have a behaviour that confuses me regarding the 
case of a disk name:

> ln -s "/cygdrive/c/Program Files" pf1
> ln -s "/cygdrive/C/Program Files" pf2
> ls -l pf*
lrwxrwxrwx 1 acn1 None 25 Jun 12 07:37 pf1 -> /cygdrive/c/Program Files
lrwxrwxrwx 1 acn1 None 20 Jun 12 07:37 pf2 -> /mnt/C/Program Files
> cygpath -ma ./pf1
C:/cygwin64/home/acn1/pf1

You see from the above that when I use cygpath to convert from a cygwin 
name the drive letter C: is returned in upper case. When that ends up 
after "/cygdrive" the path behaves as I expect almost everywhere by is 
treated specially for symbolic links. This seems to be a relatively new 
behaviour and it bit me!

[Use-case: I wanted to convert cygwin paths to be "very absolute" so that 
eg my home directory is not rendered as /home/acn1 but as 
/cygdrive/c/cygwin64/home/acn1, so I had a few lines of shell script to 
achieve that. I was building a package and I build both a cygwin32 and a 
cygwin64 version, so the "very absolute" paths are portable between the 
two worlds, both of which were important when I first set this up. Things 
recently broke and on investigation it was because somewhere deep in 
build scripts links to /mnt/C/... had been set up and were not usable. I 
can of course work round the issue but being confident I have spotted all 
cases causes me work!]

Arthur


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

* Re: symbolic links to /cygdrive/X/xxx with capital letter X
  2020-06-12  7:06 symbolic links to /cygdrive/X/xxx with capital letter X Arthur Norman
@ 2020-06-12 11:03 ` Andrey Repin
  2020-06-12 17:51   ` Wayne Davison
  2020-06-30 11:14 ` Corinna Vinschen
  1 sibling, 1 reply; 6+ messages in thread
From: Andrey Repin @ 2020-06-12 11:03 UTC (permalink / raw)
  To: Arthur Norman, cygwin

Greetings, Arthur Norman!

> This running on Windows 10 1909 and cygwin has been updated to the latest 
> version. The effect was also visible on a freshly installed minimal cygwin 
> put on an almost fresh Windows 10 VM.

> Cygwin these days seems to have a behaviour that confuses me regarding the 
> case of a disk name:

>> ln -s "/cygdrive/c/Program Files" pf1
>> ln -s "/cygdrive/C/Program Files" pf2
>> ls -l pf*
> lrwxrwxrwx 1 acn1 None 25 Jun 12 07:37 pf1 -> /cygdrive/c/Program Files
> lrwxrwxrwx 1 acn1 None 20 Jun 12 07:37 pf2 -> /mnt/C/Program Files
>> cygpath -ma ./pf1
> C:/cygwin64/home/acn1/pf1

> You see from the above that when I use cygpath to convert from a cygwin 
> name the drive letter C: is returned in upper case. When that ends up 
> after "/cygdrive" the path behaves as I expect almost everywhere by is 
> treated specially for symbolic links. This seems to be a relatively new 
> behaviour and it bit me!

> [Use-case: I wanted to convert cygwin paths to be "very absolute" so that 
> eg my home directory is not rendered as /home/acn1 but as 
> /cygdrive/c/cygwin64/home/acn1,

cygpath is not meant to replace realpath/readlink.
And you've got exactly what you asked for.
-m returns Windows path with forward slashes.
-a returns absolute path.

> so I had a few lines of shell script to
> achieve that. I was building a package and I build both a cygwin32 and a 
> cygwin64 version, so the "very absolute" paths are portable between the 
> two worlds, both of which were important when I first set this up. Things 
> recently broke and on investigation it was because somewhere deep in 
> build scripts links to /mnt/C/... had been set up and were not usable. I 
> can of course work round the issue but being confident I have spotted all 
> cases causes me work!]

readlink -e ./pf1

man readlink


-- 
With best regards,
Andrey Repin
Friday, June 12, 2020 14:01:51

Sorry for my terrible english...


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

* Re: symbolic links to /cygdrive/X/xxx with capital letter X
  2020-06-12 11:03 ` Andrey Repin
@ 2020-06-12 17:51   ` Wayne Davison
  2020-06-13 20:47     ` Andrey Repin
  0 siblings, 1 reply; 6+ messages in thread
From: Wayne Davison @ 2020-06-12 17:51 UTC (permalink / raw)
  To: cygwin

On Fri, Jun 12, 2020 at 4:05 AM Andrey Repin wrote:
> And you've got exactly what you asked for.

I think you missed the important part of the email. Distilled down,
this is wrong:

$ ln -s /cygdrive/C/Windows foo
$ readlink foo
/mnt/C/Windows

The symlink's value changed to a path that doesn't exist on a typical
install and is now broken. The original /cygdrive/C/Windows path works
fine as long as you have it mounted to ignore case. Perhaps the
rewrite (if it is even required) should change it into
/cygdrive/c/Windows?

..wayne..

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

* Re: symbolic links to /cygdrive/X/xxx with capital letter X
  2020-06-12 17:51   ` Wayne Davison
@ 2020-06-13 20:47     ` Andrey Repin
  2020-06-13 23:33       ` Wayne Davison
  0 siblings, 1 reply; 6+ messages in thread
From: Andrey Repin @ 2020-06-13 20:47 UTC (permalink / raw)
  To: Wayne Davison, cygwin

Greetings, Wayne Davison!

> On Fri, Jun 12, 2020 at 4:05 AM Andrey Repin wrote:
>> And you've got exactly what you asked for.

> I think you missed the important part of the email. Distilled down,
> this is wrong:

> $ ln -s /cygdrive/C/Windows foo
> $ readlink foo
> /mnt/C/Windows

The cygdrive prefix is resolved, if no other mount points match.
Since you have /mnt/C mount point, it is resolved first.

> The symlink's value changed to a path that doesn't exist on a typical
> install and is now broken. The original /cygdrive/C/Windows path works
> fine as long as you have it mounted to ignore case. Perhaps the
> rewrite (if it is even required) should change it into
> /cygdrive/c/Windows?

You can resolve it to `cygpath --proc-cygdrive`, which is more useful, if you
want a portable solution.


-- 
With best regards,
Andrey Repin
Saturday, June 13, 2020 23:44:47

Sorry for my terrible english...


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

* Re: symbolic links to /cygdrive/X/xxx with capital letter X
  2020-06-13 20:47     ` Andrey Repin
@ 2020-06-13 23:33       ` Wayne Davison
  0 siblings, 0 replies; 6+ messages in thread
From: Wayne Davison @ 2020-06-13 23:33 UTC (permalink / raw)
  To: cygwin

On Sat, Jun 13, 2020 at 1:50 PM Andrey Repin wrote:
> The cygdrive prefix is resolved, if no other mount points match.
> Since you have /mnt/C mount point, it is resolved first.

I wish it would have resolved it to the cygdrive prefix, because then
it would have worked (and would have been /cygdrive/C/Windows). Maybe
cygwin is getting confused by the WLS ubuntu install I have? It puts
its mounts under /mnt, but cygwin has always used the /cygdrive path.

..wayne..

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

* Re: symbolic links to /cygdrive/X/xxx with capital letter X
  2020-06-12  7:06 symbolic links to /cygdrive/X/xxx with capital letter X Arthur Norman
  2020-06-12 11:03 ` Andrey Repin
@ 2020-06-30 11:14 ` Corinna Vinschen
  1 sibling, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2020-06-30 11:14 UTC (permalink / raw)
  To: cygwin

On Jun 12 08:06, Arthur Norman via Cygwin wrote:
> This running on Windows 10 1909 and cygwin has been updated to the latest
> version. The effect was also visible on a freshly installed minimal cygwin
> put on an almost fresh Windows 10 VM.
> 
> Cygwin these days seems to have a behaviour that confuses me regarding the
> case of a disk name:
> 
> > ln -s "/cygdrive/c/Program Files" pf1
> > ln -s "/cygdrive/C/Program Files" pf2
> > ls -l pf*
> lrwxrwxrwx 1 acn1 None 25 Jun 12 07:37 pf1 -> /cygdrive/c/Program Files
> lrwxrwxrwx 1 acn1 None 20 Jun 12 07:37 pf2 -> /mnt/C/Program Files
> > cygpath -ma ./pf1
> C:/cygwin64/home/acn1/pf1
> 
> You see from the above that when I use cygpath to convert from a cygwin name
> the drive letter C: is returned in upper case. When that ends up after
> "/cygdrive" the path behaves as I expect almost everywhere by is treated
> specially for symbolic links. This seems to be a relatively new behaviour
> and it bit me!
> 
> [Use-case: I wanted to convert cygwin paths to be "very absolute" so that eg

If you want "very absolute" paths, use something like

  ln -s /proc/cygdrive/c/...

/proc/cygdrive always exists, even if you change the cygdrive prefix.
It's a virtual symlink to the actual cygdrive prefix.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

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

end of thread, other threads:[~2020-06-30 11:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12  7:06 symbolic links to /cygdrive/X/xxx with capital letter X Arthur Norman
2020-06-12 11:03 ` Andrey Repin
2020-06-12 17:51   ` Wayne Davison
2020-06-13 20:47     ` Andrey Repin
2020-06-13 23:33       ` Wayne Davison
2020-06-30 11:14 ` Corinna Vinschen

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