delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/30/10:29:08

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52UET72p1293424
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 52UET72p1293424
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=SuYuGw8j
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77D1B3858288
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1743344946;
bh=yVVDbygtEoGDnr1lJTXwxehChsiKM1JHLm0zOnZw/HI=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=SuYuGw8j7ThKN8wc9hCgZh1EXevACQqsLq4egNPDutPAaFQgQIJuqo3cjqz6yLu0o
SZYSwvwRqlfTJlPcLyr2MzK49kFtGZwcVQJiEk6Au+qhdErWqKwVcPZnZaPB7Vygwh
GsNAmWL5NekeZQJkiFagDi0GZGdWl/zDWz8D/YIc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31FA83857829
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 31FA83857829
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743344808; cv=none;
b=hYsjMUZK6RM5dKNN+zVncHL64C7k66gTTsYiFZgEeb5+vLR+IqEXfBqqVZbkYilpo8YfaD8E4Hnki8UegtAzPE22zjEk3CxXTVSpvEnAH2c5yMBa91YswgcpUcqE/J3PD2ggKbrcLMQhQxVJauyoX1OiMNr455qi++k+rcD496c=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1743344808; c=relaxed/simple;
bh=TRwwDLAm/X9A55A/tmmIKDORs49EHNk9G4ztRHw5uBc=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
b=EZQa6XSlfpRrmVV24ludbLMG00y0WSUtg4FhEvtT8/qJpTHy6PM8mfRj2YIMNTuSmAMXZ5N5Rag5ELQ2BFZVyQu1gD8Py8iEOCGpU9hdJB1+dnkyenRKIQQHmRhJOumJ5/Colc1oycOMx74IPfmifHXWeEmY3xHWvZ4Uq5eS7JI=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31FA83857829
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1743344807; x=1743949607;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:sender:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=RunFYoSqgnxORNOTP+5Agz+li0YyFmzNRnS0TjKiQpI=;
b=SrVIBTluocPHMo4A8OxLcnL/7e6ETmGvpD5Xtno0WNDzEoo7teQ7FDqeIMSh/W8adi
utzcgH7p0xr8SoNgB0JyzmXLyMsmAod3PHadCEvf3bbYfqZmq+aDIb5WjBVh74RRzaUb
K2dsA+Sm1GIqs6hNun2E3z0hUB/godOkwzp4cx+fZS0Ctzx0I6Rmg/LYy921M13/pG/1
A1wsqsvZQoMgDLllr9XyeodLKHhSSHqT4XMBXlJI0sn7aYgJkepdyUwz58L6CX+JOlo7
yE9xnHvYgxBNDT7S4PV628nSowY8yzsRrg7M+MMusz1xj6iFlC34tca3swP5XFi5gXRU
DhvQ==
X-Forwarded-Encrypted: i=1;
AJvYcCXclug2Y7pS4h8pcz1SyBkdVXJY5WC/SMtmZC0eC44be1PJFUiFmbeJd6SPKgh8HG2bQqiMVLM=@cygwin.com
X-Gm-Message-State: AOJu0Yw+nbGdnfcfUAN2sJF0j+9v3Jhk04Ln413zjEHcVSEiPc//SuZJ
3iXBlRiLxcAzvHnc1QPVP2GLNXnvm26LHlTpCuQm9qD8hoEJCq93bHH/9Xkd
X-Gm-Gg: ASbGncsk7l8Qpg0KRQ6rvlvkBJX/ie/prOMP2qqNttZw6zr8zhiebkSITXxQLEILPO+
k+h8LoX4qE8ZBiN3qehLwddidVEd/5q+fCPJZliEfdVsS2b1Qo7oY3lwtHYFjkNZ5x/yXYZcIUB
VFIPqApcq4AHlLmVc2ryNIP6klO84mm0Ga3lxbi9jP7wDRdKmPTZKgC4cj1XF3rzQ03xiVvqjvj
miu+Omwb0/IDuQKBhtsJFV6FXi1z8/H7yrGg7eCyd3rVj2ZhnN89rkVKXzlR3c6ZKzb5aHRHrvX
FZU9juzlC1lpXnKnhkirgMsVVbrG2adBbv6h0Tjx0+kyo6ZixJOroUWRCDf/JKw2pPf0B2fY55B
NCk4sO4GG17pywWFFlIkrdnKzO9+yI/fJIvQ=
X-Google-Smtp-Source: AGHT+IHVV2UHQgGIRqNiF/05EVFphu5RJhp8dOofnODh5Y1tA1H8zVZzqV/IbR4fdM/PBPky3i8VBg==
X-Received: by 2002:a05:6000:40ce:b0:391:47d8:de3a with SMTP id
ffacd0b85a97d-39c1211d34fmr4164762f8f.53.1743344806709;
Sun, 30 Mar 2025 07:26:46 -0700 (PDT)
Message-ID: <1c0fb53a-2a6d-4d9d-8dbe-d70cc9296d5d@draigBrady.com>
Date: Sun, 30 Mar 2025 15:26:44 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird Beta
Subject: Re: symbolic link curiousity in 3.6.0
To: Paul Eggert <eggert AT cs DOT ucla DOT edu>, Bruno Haible <bruno AT clisp DOT org>,
bug-gnulib AT gnu DOT org, cygwin AT cygwin DOT com, Coreutils <coreutils AT gnu DOT org>
References: <Pine DOT BSF DOT 4 DOT 63 DOT 2503250218240 DOT 74063 AT m0 DOT truegem DOT net>
<Z-aGVCUo0N1VSl5s AT calimero DOT vinschen DOT de>
<Z-aP1jhjXTUVvP-E AT calimero DOT vinschen DOT de> <11037686 DOT 3WhfQktd6Z AT nimes>
<91c9d441-36e3-4dd5-b2ca-3cfd498d2260 AT draigBrady DOT com>
<Z-fLulclFs13NfAm AT calimero DOT vinschen DOT de>
<a78f800c-0463-4efb-b431-c2c244bd13c7 AT cs DOT ucla DOT edu>
<Z-k-ALeeYtJx7SqL AT calimero DOT vinschen DOT de>
In-Reply-To: <Z-k-ALeeYtJx7SqL@calimero.vinschen.de>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: =?utf-8?q?P=C3=A1draig_Brady_via_Cygwin?= <cygwin AT cygwin DOT com>
Reply-To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P AT draigBrady DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 52UET72p1293424

On 30/03/2025 13:50, Corinna Vinschen wrote:
> Hi Paul,
> 
> thanks for the patch.
> 
> On Mar 29 10:31, Paul Eggert via Cygwin wrote:
>> On 3/29/25 04:30, Corinna Vinschen wrote:
>>> What it should do if only the POSIX.1e draft 17 functions are available
>>> is something along these lines:
>>
>> Yes, that sounds like a better approach. However, shouldn't it use O_PATH
>> not O_RDONLY? We might lack read access.
>>
>> Does the attached Gnulib patch work for you? I haven't tested or installed
>> it (I don't use Cygwin).
> 
>>  From e245ab6ac865c7ff723837645886eb717c53a754 Mon Sep 17 00:00:00 2001
>> From: Paul Eggert <eggert AT cs DOT ucla DOT edu>
>> Date: Sat, 29 Mar 2025 10:27:01 -0600
>> Subject: [PATCH] file-has-acl: port symlink code to Cygwin
>>
>> Problem reported by Corinna Vinschen in:
>> https://lists.gnu.org/r/bug-gnulib/2025-03/msg00112.html
>> * lib/file-has-acl.c (acl_get_link_np): New static function,
>> defined only if needed.
>> (HAVE_ACL_GET_LINK_NP): Define this if defining acl_get_link_np.
>> ---
>>   ChangeLog          |  9 +++++++++
>>   lib/file-has-acl.c | 21 ++++++++++++++++++++-
>>   2 files changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/ChangeLog b/ChangeLog
>> index 58195260cf..a7fa40dc33 100644
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -1,3 +1,12 @@
>> +2025-03-29  Paul Eggert  <eggert AT cs DOT ucla DOT edu>
>> +
>> +	file-has-acl: port symlink code to Cygwin
>> +	Problem reported by Corinna Vinschen in:
>> +	https://lists.gnu.org/r/bug-gnulib/2025-03/msg00112.html
>> +	* lib/file-has-acl.c (acl_get_link_np): New static function,
>> +	defined only if needed.
>> +	(HAVE_ACL_GET_LINK_NP): Define this if defining acl_get_link_np.
>> +
>>   2025-03-29  Bruno Haible  <bruno AT clisp DOT org>
>>   
>>   	acl-permissions: Update comments regarding NetBSD.
>> diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
>> index 179e805bd4..2538b61944 100644
>> --- a/lib/file-has-acl.c
>> +++ b/lib/file-has-acl.c
>> @@ -362,6 +362,25 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
>>   }
>>   #endif
>>   
>> +#if (!USE_LINUX_XATTR && USE_ACL && HAVE_ACL_GET_FD \
>> +     && !HAVE_ACL_EXTENDED_FILE && !HAVE_ACL_TYPE_EXTENDED \
>> +     && !HAVE_ACL_GET_LINK_NP && defined O_PATH)
> 
> The definition of O_PATH requires an additional
> 
>    #include <fcntl.h>
> 
> Adding that to gllib/file-has-acl.c, the patch works as desired on
> Cygwin.
> 
> However, assuming not only Cygwin is affected, shouldn't the patch
> rather use O_PATH if it's available, O_RDONLY if not?
> 
>> -#    if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10 */
>> +#    if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
> 
> Changing the comment is wrong, IMHO.  We're adding a local version of
> HAVE_ACL_GET_LINK_NP specificially because Cygwin (or, FWIW, any system
> only providing the POSIX.1e draft 17 function) does not provide
> acl_get_link_np, isn't it?
> 
> For Cygwin, I will add this function nevertheless, but it will only be
> available in some upcoming version, either 3.6.1 or 3.7.0.
> 
> In terms of coreutils, I think either ls(1) gobble_file() or
> file_has_aclinfo_cache() should still handle ENOENT from
> file_has_aclinfo() and not print any error message.  After all, due to
> the preconditions for building acl_get_link_np, we can't be sure
> acl_get_link_np has really been built into file-has-acl.c, and the
> problem persists.

I tend to agree. I'll apply this later:


commit 88385a0d6d56197d3c180432c8a4bca07241e90b (HEAD -> master)
Author: Pádraig Brady <P AT draigBrady DOT com>
Date:   Sun Mar 30 15:16:54 2025 +0100

     ls: suppress ENOENT errors when reading ACL info

     * src/ls.c (gobble_file): Indicating unknown ACL info with '?'
     suffices for the edge case of a file being removed while reading,
     or older cygwin when reading through dangling symlinks.
     Reported by Corinna Vinschen.

diff --git a/src/ls.c b/src/ls.c
index 46ec42037..2cf4ee444 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3538,8 +3538,14 @@ gobble_file (char const *name, enum filetype type, ino_t inode,

        /* Let the user know via '?' if errno is EACCES, which can
           happen with Linux kernel 6.12 on an NFS file system.
-         That's better than a longwinded diagnostic.  */
-      bool cannot_access_acl = n < 0 && errno == EACCES;
+         That's better than a longwinded diagnostic.
+
+         Similarly, ignore ENOENT which may happen on some versions
+         of cygwin when processing dangling symlinks for example.
+         Also if a file is removed while we're reading ACL info,
+         ACL_T_UNKNOWN is sufficient indication for that edge case.  */
+      bool cannot_access_acl = n < 0
+           && (errno == EACCES || errno == ENOENT);

        f->acl_type = (!have_scontext && !have_acl
                       ? (cannot_access_acl ? ACL_T_UNKNOWN : ACL_T_NONE)

cheers,
Pádraig.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019