Strange paths in NTFS reparse points created by Cygwin Setup for e.g. TTF fonts

Ken Brown kbrown@cornell.edu
Sun Nov 8 16:38:50 GMT 2020


On 11/8/2020 9:40 AM, Michael Soegtrop wrote:
> Why shouldn't I be able to remove symlinks with rm -rf from within a cygwin? As 
> far as I understand the standard behavior of "rm" is to remove the symlink and 
> not its target. What I do when I remove a cygwin installation in our CI is an 
> "rm -rf" from a different cygwin installation. As I said in most cases this 
> works but rarely it doesn't.
[...]
> I understand that the contents / path of the symlink is as expected, so I am 
> looking out for other oddities which could explain this behavior.

I've seen this behavior only in the following situation.  Suppose you create a 
symlink in one Cygwin installation that uses WSL symlinks.  Then you try to 
delete it from a different Cygwin installation with version < 3.1.5 (which is 
when WSL symlinks were first supported).  This will fail, because the older 
Cygwin installation will see a reparse point of a type that it doesn't recognize.

 From what you say, it sounds like this doesn't apply to your situation, so I'm 
at a loss to explain it.

Do you get any error message when you're unable to delete a symlink in one 
Cygwin installation from another?  If not, you could try running 'rm <cygwin 
root>/usr/share/fonts/microsoft/wingding.ttf' under strace to see if that give 
you any clues.  You could also try 'file', 'ls -l', 'stat', etc., to see if 
Cygwin is correctly recognizing the file as a symlink.

For example, I have a Cygwin installation in C:\cygwin64test.  From a different 
Cygwin installation in which C: is mounted on /c, I see the following:

$ file /c/cygwin64test/usr/share/fonts/microsoft/wingding.ttf
/c/cygwin64test/usr/share/fonts/microsoft/wingding.ttf: symbolic link to 
/c/Windows/Fonts/wingding.ttf

Now I remove that symlink under strace:

$ strace -o strace.out rm /c/cygwin64test/usr/share/fonts/microsoft/wingding.ttf

In the file strace.out I see

    57   26112 [main] rm 39456 symlink_info::check: 0x0 = NtCreateFile 
(\??\C:\cygwin64test\usr\share\fonts\microsoft\wingding.ttf)
   100   26212 [main] rm 39456 symlink_info::check: 29 = 
symlink.check(C:\cygwin64test\usr\share\fonts\microsoft\wingding.ttf, 
0xFFFFB680) (mount_flags 0x4008, path_flags 0x10)
    26   26238 [main] rm 39456 path_conv::check: 
this->path(C:\cygwin64test\usr\share\fonts\microsoft\wingding.ttf), has_acls(1)
    25   26263 [main] rm 39456 _unlink_nt: Trying to delete 
\??\C:\cygwin64test\usr\share\fonts\microsoft\wingding.ttf, isdir = 0
   218   26481 [main] rm 39456 _unlink_nt: 
\??\C:\cygwin64test\usr\share\fonts\microsoft\wingding.ttf, return status = 0x0
    33   26514 [main] rm 39456 unlink: 0 = 
unlink(/c/cygwin64test/usr/share/fonts/microsoft/wingding.ttf)

In your case I would expect to see some errors reported when you are unable to 
remove the symlink.

Ken


More information about the Cygwin mailing list