From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mercury.signalpunk.com (mercury.signalpunk.com [169.45.121.165]) by sourceware.org (Postfix) with ESMTP id 29475384640E for ; Wed, 24 Apr 2024 20:50:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29475384640E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=anodized.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anodized.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 29475384640E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=169.45.121.165 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713991825; cv=none; b=IpkzZd2V46iKbDib9d4xNPT4z+QYti6avNiGp3xBnC1s6Qedf+3Tuuff9MUklfpfPrlKJYGlv1g88fQARyrBPwNtWZAg+jXAfJM+D/xr9EN7Yqsp0PQU/DK8FeNWOzvIj+4BnmwnOKL/lpZ/6lD8eO0zCh6n8u6Va5olexmJlFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713991825; c=relaxed/simple; bh=SfMBqViVJiBHO7gQbk6A2A/TZMa0f9/4R08a5XVKum0=; h=From:Mime-Version:Subject:Message-Id:Date:To; b=ARfAAnD1AxCYJX0xNY+hocsumvNXoH6abua1fLoJk8Zi4zEsA2DrIW/2t04AX4NUnbsF8hINdrl+UffdexBp7kBKMvhrjrqp8JKDMN47dIzOq8vhSqysco7f4EcbNh1rHn5nBa8mJ/VeW+LMxYMlkpTnj+EQFwXM+YNipyoWibI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtpclient.apple (c-73-92-114-165.hsd1.ca.comcast.net [73.92.114.165]) (Authenticated sender: clayne) by mercury.signalpunk.com (Postfix) with ESMTPSA id 5BE05400E4C91 for ; Wed, 24 Apr 2024 20:50:23 +0000 (UTC) From: Christopher Layne Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Issue with cygdrive mount, native symlinks, and noacl option Message-Id: <2AD67AA7-33D1-43FF-9543-20A687E0D4CC@anodized.com> Date: Wed, 24 Apr 2024 13:50:11 -0700 To: cygwin@cygwin.com X-Mailer: Apple Mail (2.3774.500.171.1.1) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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/ /. 2. All symlinks are actually native reparse points as a I run with = CYGWIN=3Dwinsymlinks: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 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=3Dwinsymlinks 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). * I also know how to avoid the issue entirely by using /cygdrive/ 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. * 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. Here's a repro case: clayne@sv590:~ $ uname -a CYGWIN_NT-10.0-19045 sv590 3.5.3-1.x86_64 2024-04-03 17:25 UTC x86_64 = Cygwin clayne@sv590:~ $ cat /tmp/link_test=20 #!/bin/bash set -e set -o pipefail rm -rf /cygdrive/{f,s}/link_test mkdir -p /cygdrive/{f,s}/link_test echo foo > /cygdrive/f/link_test/test for i in winsymlinks winsymlinks:lnk winsymlinks:sys = winsymlinks:nativestrict; do export CYGWIN=3D"$i" link=3D"s_${i//:/_}" ln -sfT /cygdrive/s /$link rsync -aSH /f/link_test/ "/$link/link_test/$link"/ ls -la /$link/link_test/$link/test || true getfacl /$link/link_test/$link/test || true done clayne@sv590:~ $ bash -x /tmp/link_test=20 + set -e + set -o pipefail + rm -rf /cygdrive/f/link_test /cygdrive/s/link_test + mkdir -p /cygdrive/f/link_test /cygdrive/s/link_test + echo foo + for i in winsymlinks winsymlinks:lnk winsymlinks:sys = winsymlinks:nativestrict + export CYGWIN=3Dwinsymlinks + CYGWIN=3Dwinsymlinks + link=3Ds_winsymlinks + ln -sfT /cygdrive/s /s_winsymlinks + rsync -aSH /f/link_test/ /s_winsymlinks/link_test/s_winsymlinks/ + ls -la /s_winsymlinks/link_test/s_winsymlinks/test -rw-r--r-- 1 clayne None 4 Apr 24 13:38 = /s_winsymlinks/link_test/s_winsymlinks/test + getfacl /s_winsymlinks/link_test/s_winsymlinks/test getfacl: /s_winsymlinks/link_test/s_winsymlinks/test: Not supported + true + for i in winsymlinks winsymlinks:lnk winsymlinks:sys = winsymlinks:nativestrict + export CYGWIN=3Dwinsymlinks:lnk + CYGWIN=3Dwinsymlinks:lnk + link=3Ds_winsymlinks_lnk + ln -sfT /cygdrive/s /s_winsymlinks_lnk + rsync -aSH /f/link_test/ = /s_winsymlinks_lnk/link_test/s_winsymlinks_lnk/ + ls -la /s_winsymlinks_lnk/link_test/s_winsymlinks_lnk/test -rw-r--r-- 1 clayne None 4 Apr 24 13:38 = /s_winsymlinks_lnk/link_test/s_winsymlinks_lnk/test + getfacl /s_winsymlinks_lnk/link_test/s_winsymlinks_lnk/test getfacl: /s_winsymlinks_lnk/link_test/s_winsymlinks_lnk/test: Not = supported + true + for i in winsymlinks winsymlinks:lnk winsymlinks:sys = winsymlinks:nativestrict + export CYGWIN=3Dwinsymlinks:sys + CYGWIN=3Dwinsymlinks:sys + link=3Ds_winsymlinks_sys + ln -sfT /cygdrive/s /s_winsymlinks_sys + rsync -aSH /f/link_test/ = /s_winsymlinks_sys/link_test/s_winsymlinks_sys/ + ls -la /s_winsymlinks_sys/link_test/s_winsymlinks_sys/test -rw-r--r-- 1 clayne None 4 Apr 24 13:38 = /s_winsymlinks_sys/link_test/s_winsymlinks_sys/test + getfacl /s_winsymlinks_sys/link_test/s_winsymlinks_sys/test getfacl: /s_winsymlinks_sys/link_test/s_winsymlinks_sys/test: Not = supported + true + for i in winsymlinks winsymlinks:lnk winsymlinks:sys = winsymlinks:nativestrict + export CYGWIN=3Dwinsymlinks:nativestrict + CYGWIN=3Dwinsymlinks:nativestrict + link=3Ds_winsymlinks_nativestrict + ln -sfT /cygdrive/s /s_winsymlinks_nativestrict + rsync -aSH /f/link_test/ = /s_winsymlinks_nativestrict/link_test/s_winsymlinks_nativestrict/ + ls -la = /s_winsymlinks_nativestrict/link_test/s_winsymlinks_nativestrict/test -rwxrwx---+ 1 clayne None 4 Apr 24 13:38 = /s_winsymlinks_nativestrict/link_test/s_winsymlinks_nativestrict/test + getfacl = /s_winsymlinks_nativestrict/link_test/s_winsymlinks_nativestrict/test # file: = /s_winsymlinks_nativestrict/link_test/s_winsymlinks_nativestrict/test # owner: clayne # group: None user::rwx group::r-x group:Authenticated Users:rwx group:SYSTEM:rwx group:Administrators:rwx group:Users:r-x mask::rwx other::--- I obviously can't include explorer screencaps, but suffice to say, = "winsymlinks:nativestrict" is the only one that ends up with NULL SID, = incorrect order, etc issues on the synced files. -cl