public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin 3.3.4 - cmd to symlinked path doesn't work
@ 2022-02-01 11:46 BRISLANE Mark
  2022-02-01 12:47 ` Andrey Repin
  0 siblings, 1 reply; 6+ messages in thread
From: BRISLANE Mark @ 2022-02-01 11:46 UTC (permalink / raw)
  To: cygwin

Hi,

We had this issue in 3.3.3 and is down as being fixed in 3.3.4-2 but perhaps our scenario is slightly different because it's still happening. SERVER1 has a folder on D: called folder 1, which is a symlink to "\\server2\share\folder1" - created with mklink /D folder1 \\server2\share\folder1

DOMAIN+Administrator@SERVER1 /cygdrive/d
$ ls -l
total 3
drwxr-x---+ 1 Administrators SERVER1+None     0 Jan 28 11:03 '$RECYCLE.BIN'
d---rwx---+ 1 Administrators SYSTEM                0 Jan 25 23:07 'System Volume Information'
lrwxrwxrwx  1 Administrators DOMAIN+Domain Users   32 Nov  9 10:52  folder1 -> //server2/share/folder1

DOMAIN+Administrator@SERVER1 /cygdrive/d
$ cd folder1

DOMAIN+Administrator@SERVER1 /cygdrive/d/folder1
$ cmd
'\\server2\share\folder1'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Windows>

This used to work in older versions of Cygwin.

Regards,
Mark



Internal

This email is from AXA Partners. It is strictly confidential and may contain legally privileged information. If you are not the intended recipient you must not copy, disclose or otherwise use such information. If you have received this email in error please immediately delete it from your system and email us to inform the sender.
 
AXA France IARD S.A. (Branch No: 624115. French Company No: 722 057 460. ACPR No: 4022109.) and AXA France Vie S.A (Branch No: 62116. French Company No: 310 499 959. ACPR No: 5020051.) have a registered office at Building 7000, Atlantic Avenue, Westpark Business Campus, Shannon, County Clare. Each company is a Société Anonyme registered in France with its registered address at 313, Terrasses de l'Arche, 92000 Nanterre, France. The following are directors of both AXA France IARD S.A. and AXA France Vie S.A.: Jacques de Peretti (French), Alexis Babeau (French), Alain Dubois (French), Renée Habozit (French), Sandra le Grand (French), Cécile Moulard (French), Alban de Mailly Nesle (French). Martine Bievre (French) is a director AXA France IARD S.A. Christine Sinibardy (French) is a director of AXA France Vie S.A.

AXA France IARD S.A. and AXA France Vie S.A. both trade under the name of 'AXA Partners – Credit & Lifestyle Protection', are authorised by Autorité de Contrôle Prudential et de Résolution (ACPR) in France and are regulated by the Central Bank of Ireland for conduct of business rules. 

AXA Partners S.A.S. (Branch No: 908621. French Company No: 813 778 412 RCS Nanterre. Orias No: 15006083) has its registered office at Building 7000, Atlantic Avenue, Westpark Business Campus, Shannon, County Clare. Sophie Latil (French) is the President and CEO of the company.  The company is a private limited company registered in France with its registered address at 313 Terrasses de L’Arche, 92727 Nanterre Cedex, France.

AXA Partners S.A.S. trades under the name of  'AXA Partners – Credit & Lifestyle Protection',  is authorised by ORIAS in France and is regulated by the Central Bank of Ireland for conduct of business rules.

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

* Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work
  2022-02-01 11:46 Cygwin 3.3.4 - cmd to symlinked path doesn't work BRISLANE Mark
@ 2022-02-01 12:47 ` Andrey Repin
  2022-02-01 14:03   ` [EXTERNAL] " BRISLANE Mark
  2022-02-01 14:34   ` Corinna Vinschen
  0 siblings, 2 replies; 6+ messages in thread
From: Andrey Repin @ 2022-02-01 12:47 UTC (permalink / raw)
  To: BRISLANE Mark, cygwin

Greetings, BRISLANE Mark!

> We had this issue in 3.3.3 and is down as being fixed in 3.3.4-2 but
> perhaps our scenario is slightly different because it's still happening.
> SERVER1 has a folder on D: called folder 1, which is a symlink to
> "\\server2\share\folder1" - created with mklink /D folder1 \\server2\share\folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d
> $ ls -l
> total 3
> drwxr-x---+ 1 Administrators SERVER1+None     0 Jan 28 11:03 '$RECYCLE.BIN'
> d---rwx---+ 1 Administrators SYSTEM                0 Jan 25 23:07 'System Volume Information'
> lrwxrwxrwx  1 Administrators DOMAIN+Domain Users   32 Nov  9 10:52  folder1 -> //server2/share/folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d
> $ cd folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d/folder1
> $ cmd
> '\\server2\share\folder1'
> CMD.EXE was started with the above path as the current directory.
> UNC paths are not supported.  Defaulting to Windows directory.
> Microsoft Windows [Version 10.0.14393]
> (c) 2016 Microsoft Corporation. All rights reserved.

> C:\Windows>

> This used to work in older versions of Cygwin.

The interesting part is that the behavior is dependent on sequence of events.

`mintty bash -i` in a directory:

> $ pwd
> /cygdrive/d/cygwin
> $ cmd
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> D:\cygwin> exit
>
> $ cd $( pwd )
> $ pwd
> /cygdrive/d/cygwin
> $ cmd
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> \\DAEMON1.DARKDRAGON.LAN\arc\cygwin>


-- 
With best regards,
Andrey Repin
Tuesday, February 1, 2022 15:28:28

Sorry for my terrible english...


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

* RE: [EXTERNAL] Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work
  2022-02-01 12:47 ` Andrey Repin
@ 2022-02-01 14:03   ` BRISLANE Mark
  2022-02-01 14:34   ` Corinna Vinschen
  1 sibling, 0 replies; 6+ messages in thread
From: BRISLANE Mark @ 2022-02-01 14:03 UTC (permalink / raw)
  To: cygwin

Hi there,

I wonder if this is OS dependent? I note you're on Windows 7 / Server 2008 R2 (both EOL by the way!) where as I'm on Windows Server 2016.

The server where this works on an older version of Cygwin is Server 2012 R2, and I've copied the cygwin1.dll from that server to my Server 2016 server but the issue still happens.

Regards,
Mark


Internal

-----Original Message-----
From: Andrey Repin <anrdaemon@yandex.ru> 
Sent: Tuesday 1 February 2022 12:47
To: BRISLANE Mark <mark.brislane@partners.axa>; cygwin@cygwin.com
Subject: [EXTERNAL] Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work

Greetings, BRISLANE Mark!

> We had this issue in 3.3.3 and is down as being fixed in 3.3.4-2 but 
> perhaps our scenario is slightly different because it's still happening.
> SERVER1 has a folder on D: called folder 1, which is a symlink to 
> "\\server2\share\folder1" - created with mklink /D folder1 
> \\server2\share\folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d
> $ ls -l
> total 3
> drwxr-x---+ 1 Administrators SERVER1+None     0 Jan 28 11:03 '$RECYCLE.BIN'
> d---rwx---+ 1 Administrators SYSTEM                0 Jan 25 23:07 'System Volume Information'
> lrwxrwxrwx  1 Administrators DOMAIN+Domain Users   32 Nov  9 10:52  folder1 -> //server2/share/folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d
> $ cd folder1

> DOMAIN+Administrator@SERVER1 /cygdrive/d/folder1
> $ cmd
> '\\server2\share\folder1'
> CMD.EXE was started with the above path as the current directory.
> UNC paths are not supported.  Defaulting to Windows directory.
> Microsoft Windows [Version 10.0.14393]
> (c) 2016 Microsoft Corporation. All rights reserved.

> C:\Windows>

> This used to work in older versions of Cygwin.

The interesting part is that the behavior is dependent on sequence of events.

`mintty bash -i` in a directory:

> $ pwd
> /cygdrive/d/cygwin
> $ cmd
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> D:\cygwin> exit
>
> $ cd $( pwd )
> $ pwd
> /cygdrive/d/cygwin
> $ cmd
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> \\DAEMON1.DARKDRAGON.LAN\arc\cygwin>


--
With best regards,
Andrey Repin
Tuesday, February 1, 2022 15:28:28

Sorry for my terrible english...

This email is from AXA Partners. It is strictly confidential and may contain legally privileged information. If you are not the intended recipient you must not copy, disclose or otherwise use such information. If you have received this email in error please immediately delete it from your system and email us to inform the sender.
 
AXA France IARD S.A. (Branch No: 624115. French Company No: 722 057 460. ACPR No: 4022109.) and AXA France Vie S.A (Branch No: 62116. French Company No: 310 499 959. ACPR No: 5020051.) have a registered office at Building 7000, Atlantic Avenue, Westpark Business Campus, Shannon, County Clare. Each company is a Société Anonyme registered in France with its registered address at 313, Terrasses de l'Arche, 92000 Nanterre, France. The following are directors of both AXA France IARD S.A. and AXA France Vie S.A.: Jacques de Peretti (French), Alexis Babeau (French), Alain Dubois (French), Renée Habozit (French), Sandra le Grand (French), Cécile Moulard (French), Alban de Mailly Nesle (French). Martine Bievre (French) is a director AXA France IARD S.A. Christine Sinibardy (French) is a director of AXA France Vie S.A.

AXA France IARD S.A. and AXA France Vie S.A. both trade under the name of 'AXA Partners – Credit & Lifestyle Protection', are authorised by Autorité de Contrôle Prudential et de Résolution (ACPR) in France and are regulated by the Central Bank of Ireland for conduct of business rules. 

AXA Partners S.A.S. (Branch No: 908621. French Company No: 813 778 412 RCS Nanterre. Orias No: 15006083) has its registered office at Building 7000, Atlantic Avenue, Westpark Business Campus, Shannon, County Clare. Sophie Latil (French) is the President and CEO of the company.  The company is a private limited company registered in France with its registered address at 313 Terrasses de L’Arche, 92727 Nanterre Cedex, France.

AXA Partners S.A.S. trades under the name of  'AXA Partners – Credit & Lifestyle Protection',  is authorised by ORIAS in France and is regulated by the Central Bank of Ireland for conduct of business rules.

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

* Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work
  2022-02-01 12:47 ` Andrey Repin
  2022-02-01 14:03   ` [EXTERNAL] " BRISLANE Mark
@ 2022-02-01 14:34   ` Corinna Vinschen
  2022-02-03 10:56     ` Andrey Repin
  1 sibling, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2022-02-01 14:34 UTC (permalink / raw)
  To: cygwin

On Feb  1 15:47, Andrey Repin wrote:
> Greetings, BRISLANE Mark!
> 
> > We had this issue in 3.3.3 and is down as being fixed in 3.3.4-2 but
> > perhaps our scenario is slightly different because it's still happening.
> > SERVER1 has a folder on D: called folder 1, which is a symlink to
> > "\\server2\share\folder1" - created with mklink /D folder1 \\server2\share\folder1
> 
> > DOMAIN+Administrator@SERVER1 /cygdrive/d
> > $ ls -l
> > total 3
> > drwxr-x---+ 1 Administrators SERVER1+None     0 Jan 28 11:03 '$RECYCLE.BIN'
> > d---rwx---+ 1 Administrators SYSTEM                0 Jan 25 23:07 'System Volume Information'
> > lrwxrwxrwx  1 Administrators DOMAIN+Domain Users   32 Nov  9 10:52  folder1 -> //server2/share/folder1
> 
> > DOMAIN+Administrator@SERVER1 /cygdrive/d
> > $ cd folder1
> 
> > DOMAIN+Administrator@SERVER1 /cygdrive/d/folder1
> > $ cmd
> > '\\server2\share\folder1'
> > CMD.EXE was started with the above path as the current directory.
> > UNC paths are not supported.  Defaulting to Windows directory.
> > Microsoft Windows [Version 10.0.14393]
> > (c) 2016 Microsoft Corporation. All rights reserved.
> 
> > C:\Windows>
> 
> > This used to work in older versions of Cygwin.
> 
> The interesting part is that the behavior is dependent on sequence of events.
> 
> `mintty bash -i` in a directory:
> 
> > $ pwd
> > /cygdrive/d/cygwin
> > $ cmd
> > Microsoft Windows [Version 6.1.7601]
> > Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
> >
> > D:\cygwin> exit

Not sure how you did that, but I can't reproduce this, and I'm pretty
certain the CMD failure is how Cygwin works for a long time.  I get this
same behaviour back to Cygwin 3.1.7, which is where I stopped testing.

The reason is this:

Reparse points created with mklink /d are evaluated as symlinks. This
reparse point contains an absolute UNC path.  If you cd to this dir in
Cygwin, Cygwin evaluates the path and reads the symlink content.  Given
the content is an absolute path, the symlink content replaces the
entire path.  Internally the CWD is stored twice, once in POSIX, once
in Windows syntax.  In short, what happens is this:

  pwd		-> 	POSIX(/cygdrive/d), WIN(D:)
  cd cygwin	->	
    open reparse point "cygwin"
    read content == "\\server2\share\folder1"
    convert to POSIX == "//server2/share/folder1"
    restart path evaluation and check for further symlinks
    -> no further symlinks
    convert path to Windows == "\\server2\share\folder1"
    store both paths as new CWD
  pwd		->	POSIX(//server2/share/folder1),
  			WIN(\\server2\share\folder1)

So what happens in bash?

  $ pwd
  /cygdrive/d
  $ cd cygwin
  $ pwd
  /cygdrive/d/cygwin
  $ /bin/pwd
  //server2/share/folder1

pwd is a builtin command.  It works differently from /bin/pwd in that
bash pwd does not cd to a dir and then reads the dir stored in the OS
again.  Rather it just appends the new dir as has been given on the CLI.
There's a setting somewhere to make bash reevaluate the CWD all the time
but I don't know it off the top of my head.

Bottom line is, that *in fact* the CWD in the underlying Cygwin layer is
the share, not the drive letter path.  And that's what any subsequently
started process gets as CWD, CMD just as well as any Cygwin process.

If you want CMD to succeed in this scenario all the time, you have to
start CMD in /cygdrive/d and then pushd or cd to the cygwin dir.  CMD
will not evaluate the reparse point as symlink and just go ahead.

Alternatively, just use powershell if you need a native shell.  Powershell
has no problem with UNC paths as CWD.

I hope that explains it sufficiently.


Corinna

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

* Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work
  2022-02-01 14:34   ` Corinna Vinschen
@ 2022-02-03 10:56     ` Andrey Repin
  2022-02-03 11:34       ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Andrey Repin @ 2022-02-03 10:56 UTC (permalink / raw)
  To: Corinna Vinschen, cygwin

Greetings, Corinna Vinschen!

> On Feb  1 15:47, Andrey Repin wrote:
>> Greetings, BRISLANE Mark!
>> 
>> > We had this issue in 3.3.3 and is down as being fixed in 3.3.4-2 but
>> > perhaps our scenario is slightly different because it's still happening.
>> > SERVER1 has a folder on D: called folder 1, which is a symlink to
>> > "\\server2\share\folder1" - created with mklink /D folder1 \\server2\share\folder1
>> 
>> > DOMAIN+Administrator@SERVER1 /cygdrive/d
>> > $ ls -l
>> > total 3
>> > drwxr-x---+ 1 Administrators SERVER1+None     0 Jan 28 11:03 '$RECYCLE.BIN'
>> > d---rwx---+ 1 Administrators SYSTEM                0 Jan 25 23:07 'System Volume Information'
>> > lrwxrwxrwx  1 Administrators DOMAIN+Domain Users   32 Nov  9 10:52  folder1 -> //server2/share/folder1
>> 
>> > DOMAIN+Administrator@SERVER1 /cygdrive/d
>> > $ cd folder1
>> 
>> > DOMAIN+Administrator@SERVER1 /cygdrive/d/folder1
>> > $ cmd
>> > '\\server2\share\folder1'
>> > CMD.EXE was started with the above path as the current directory.
>> > UNC paths are not supported.  Defaulting to Windows directory.
>> > Microsoft Windows [Version 10.0.14393]
>> > (c) 2016 Microsoft Corporation. All rights reserved.
>> 
>> > C:\Windows>
>> 
>> > This used to work in older versions of Cygwin.
>> 
>> The interesting part is that the behavior is dependent on sequence of events.
>> 
>> `mintty bash -i` in a directory:
>> 
>> > $ pwd
>> > /cygdrive/d/cygwin
>> > $ cmd
>> > Microsoft Windows [Version 6.1.7601]
>> > Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>> >
>> > D:\cygwin> exit

> Not sure how you did that,

Did what? Opened an interactive shell in a directory? Navigated into it in a
different file manager and just used a command.
Opened CMD in an UNC path?

reg ADD "HKCU\\Software\\Microsoft\\Command Processor" /f /v "DisableUNCCheck" /t REG_DWORD /d 1

Not even required to re-login.
Or globally for entire system in HKLM\SOFTWARE\Microsoft\Command Processor
(keep in mind there's 32- and 64-bit variants of the key, you'd have to modify
both to get consistent behavior).

> but I can't reproduce this, and I'm pretty certain the CMD failure is how
> Cygwin works for a long time.  I get this same behaviour back to Cygwin
> 3.1.7, which is where I stopped testing.

Win10 this time:

anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ pwd
/mnt/d/Reserv/test/cygwin
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ cmd
Microsoft Windows [Version 10.0.19044.1466]
(c) Microsoft Corporation. All rights reserved.

D:\Reserv\test\cygwin>exit
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ cd $( pwd )
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ pwd
/mnt/d/Reserv/test/cygwin
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ cmd
'\\DAEMON1.DARKDRAGON.LAN\arc\cygwin'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Microsoft Windows [Version 10.0.19044.1466]
(c) Microsoft Corporation. All rights reserved.

C:\Windows>exit

## Here I fixed the CMD settings in a different elevated window

anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ cmd
Microsoft Windows [Version 10.0.19044.1466]
(c) Microsoft Corporation. All rights reserved.

\\DAEMON1.DARKDRAGON.LAN\arc\cygwin>exit
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$

> The reason is this:

> Reparse points created with mklink /d are evaluated as symlinks. This
> reparse point contains an absolute UNC path.  If you cd to this dir in
> Cygwin, Cygwin evaluates the path and reads the symlink content.  Given
> the content is an absolute path, the symlink content replaces the
> entire path.  Internally the CWD is stored twice, once in POSIX, once
> in Windows syntax.  In short, what happens is this:

>   pwd           ->      POSIX(/cygdrive/d), WIN(D:)
>   cd cygwin     ->      
>     open reparse point "cygwin"
>     read content == "\\server2\share\folder1"
>     convert to POSIX == "//server2/share/folder1"
>     restart path evaluation and check for further symlinks
>     -> no further symlinks
>     convert path to Windows == "\\server2\share\folder1"
>     store both paths as new CWD
>   pwd           ->      POSIX(//server2/share/folder1),
>                         WIN(\\server2\share\folder1)

> So what happens in bash?

>   $ pwd
>   /cygdrive/d
>   $ cd cygwin
>   $ pwd
>   /cygdrive/d/cygwin
>   $ /bin/pwd
>   //server2/share/folder1

Except if you don't "cd", it uses whatever is given by the operating system.

anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ pwd.exe
/mnt/d/Reserv/test/cygwin
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ cd $(pwd)
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$ pwd.exe
//DAEMON1.DARKDRAGON.LAN/arc/cygwin
anrdaemon@Daemon-EC:xterm:/mnt/d/Reserv/test/cygwin
$

> pwd is a builtin command.  It works differently from /bin/pwd in that
> bash pwd does not cd to a dir and then reads the dir stored in the OS
> again.  Rather it just appends the new dir as has been given on the CLI.
> There's a setting somewhere to make bash reevaluate the CWD all the time
> but I don't know it off the top of my head.

> Bottom line is, that *in fact* the CWD in the underlying Cygwin layer is
> the share, not the drive letter path.  And that's what any subsequently
> started process gets as CWD, CMD just as well as any Cygwin process.

> If you want CMD to succeed in this scenario all the time, you have to
> start CMD in /cygdrive/d and then pushd or cd to the cygwin dir.  CMD
> will not evaluate the reparse point as symlink and just go ahead.

> Alternatively, just use powershell if you need a native shell.  Powershell
> has no problem with UNC paths as CWD.

> I hope that explains it sufficiently.

I though, by the time everybody had learned to suppress that stupid CMD
behavior, but here it is once again.


-- 
With best regards,
Andrey Repin
Thursday, February 3, 2022 11:40:48

Sorry for my terrible english...


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

* Re: Cygwin 3.3.4 - cmd to symlinked path doesn't work
  2022-02-03 10:56     ` Andrey Repin
@ 2022-02-03 11:34       ` Corinna Vinschen
  0 siblings, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2022-02-03 11:34 UTC (permalink / raw)
  To: cygwin

On Feb  3 13:56, Andrey Repin wrote:
> Greetings, Corinna Vinschen!
> 
> > On Feb  1 15:47, Andrey Repin wrote:
> >> The interesting part is that the behavior is dependent on sequence of events.
> >> 
> >> `mintty bash -i` in a directory:
> >> 
> >> > $ pwd
> >> > /cygdrive/d/cygwin
> >> > $ cmd
> >> > Microsoft Windows [Version 6.1.7601]
> >> > Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
> >> >
> >> > D:\cygwin> exit
> 
> > Not sure how you did that,
> 
> Did what? Opened an interactive shell in a directory? Navigated into it in a
> different file manager and just used a command.

That's the trick!  I never use this functionality so I wasn't able to
reproduce.

> Opened CMD in an UNC path?
> 
> reg ADD "HKCU\\Software\\Microsoft\\Command Processor" /f /v "DisableUNCCheck" /t REG_DWORD /d 1
> 
> Not even required to re-login.
> Or globally for entire system in HKLM\SOFTWARE\Microsoft\Command Processor

Ahhh, thanks for this registry key setting.  I remembered vaguely that
such a setting exists, but my internet searches failed to uncover it, so
I thought I had imagined things :)

> > Reparse points created with mklink /d are evaluated as symlinks. This
> > reparse point contains an absolute UNC path.  If you cd to this dir in
> > Cygwin, Cygwin evaluates the path and reads the symlink content.  Given
> > the content is an absolute path, the symlink content replaces the
> > entire path.  Internally the CWD is stored twice, once in POSIX, once
> > in Windows syntax.  In short, what happens is this:
> 
> >   pwd           ->      POSIX(/cygdrive/d), WIN(D:)
> >   cd cygwin     ->      
> >     open reparse point "cygwin"
> >     read content == "\\server2\share\folder1"
> >     convert to POSIX == "//server2/share/folder1"
> >     restart path evaluation and check for further symlinks
> >     -> no further symlinks
> >     convert path to Windows == "\\server2\share\folder1"
> >     store both paths as new CWD
> >   pwd           ->      POSIX(//server2/share/folder1),
> >                         WIN(\\server2\share\folder1)
> 
> > So what happens in bash?
> 
> >   $ pwd
> >   /cygdrive/d
> >   $ cd cygwin
> >   $ pwd
> >   /cygdrive/d/cygwin
> >   $ /bin/pwd
> >   //server2/share/folder1
> 
> Except if you don't "cd", it uses whatever is given by the operating system.

Yeah, that's right and explains that this worked for you.  We could run
GetFinalPathNameByHandleW on the CWD if the Cygwin process is the root
of the process tree, but I'm not sure it's worth it.

> I though, by the time everybody had learned to suppress that stupid CMD
> behavior, but here it is once again.

Yeah, guilty as charged.  Thanks again for the registry key!


Corinna

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

end of thread, other threads:[~2022-02-03 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 11:46 Cygwin 3.3.4 - cmd to symlinked path doesn't work BRISLANE Mark
2022-02-01 12:47 ` Andrey Repin
2022-02-01 14:03   ` [EXTERNAL] " BRISLANE Mark
2022-02-01 14:34   ` Corinna Vinschen
2022-02-03 10:56     ` Andrey Repin
2022-02-03 11:34       ` 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).