Issue with cygdrive mount, native symlinks, and noacl option

Andrey Repin anrdaemon@yandex.ru
Fri Apr 26 07:25:02 GMT 2024


Greetings, Christopher Layne!

> I noticed recently while attempting to rsync directories from one drive to
> another that I was getting the familiar "NULL SID", "incorrectly ordered",
> etc. type ownership issues on the destination even though I use noacl for
> cygdrive mounts (I'm aware of the POSIX vs windows ACL issues, etc. hence
> why I use "noacl" for cygdrive). I was able to track down the issue to a
> specific combination of things that creates the problem:

> 1. I have symlinks in / for each drive pointing to /cygdrive/[a-z] via ln -s /cygdrive/<x> /<x>.

Just make cygdrive prefix / in this case.
Portable apps should use /proc/cygdrive/ regardless.

> 2. All symlinks are actually native reparse points as a I run with
> CYGWIN=winsymlinks:nativestrict by default.

> Example:

> clayne@sv590:/ $ ls -lad /[a-z]
> lrwxrwxrwx 1 clayne None 11 Apr 24 12:24 /c -> /cygdrive/c
> lrwxrwxrwx 1 clayne None 11 Apr 24 12:24 /e -> /cygdrive/e
> lrwxrwxrwx 1 clayne None 11 Apr 24 12:24 /f -> /cygdrive/f
> lrwxrwxrwx 1 clayne None 11 Apr 24 12:24 /s -> /cygdrive/s

What is the actual symlink target? (not what is reported by Cygwin)

> 3. I issue the rsync with something like: rsync -avSHP /f/some-dir/ /s/some-dir/

> The issue here is that it appears mount related options such as noacl are
> evaluated differently when native symlinks are used. If I change the
> destination to instead be "/cygdrive/s/dest/dir" then noacl works
> appropriately. On top of all this, if I instead create the /s symlink as a
> "cygwin" style symlink via CYGWIN=winsymlinks things also work correctly -
> that is, the noacl option is used. What I would intuitively expect, atleast
> within the context of acl vs noacl, is for the symlinks to be resolved first
> and then mount options specific to the target resolved based off what the
> symlink actually points to. In the native/nativestrict case, it appears to
> be doing this in reverse and inheriting /'s standard default acl option
> rather than /cygdrive's noacl option.

> Footnotes on workarounds:

> * I know how to workaround using the root-level symlinks in the first place
> by just mounting cygdrive to /, but I'd have to update various scripts which
> already use /cygdrive and I like having the "windows drives" self-contained
> under /cygdrive (even though I frequently use the / level symlinks as shorthand).

See the note above about portable apps.

> * I also know how to avoid the issue entirely by using /cygdrive/<x> for
> the destination but the underlying issue still seems like a bug or an
> oversight to me, particularly given that nativestrict behaves differently
> when it comes to evaluating mount options.

See...

> * Another workaround would be to use non-nativestrict symlinks but I want
> to preserve interoperability with native windows applications outside of
> cygwin and I've learned over the years to just avoid anything that isn't
> nativestrict.

I'm with you here.


-- 
With best regards,
Andrey Repin
Friday, April 26, 2024 10:20:43

Sorry for my terrible english...



More information about the Cygwin mailing list