X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C74CC385E00F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1709936861;
	bh=II5Sctjnla9sR/C+HfhCzMh4wTjjcyElLRUvWNZSegU=;
	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=XbfvryxC5CCZmK3bQ1gyYuIid5Tf4TADLy25hELU1GkMcz15rhOjiBTQNA0l+6D1U
	 lWd81DLBdkydVNdVeSOpWY30NJumg0BWZopJiYy58RnsZ7lMZcnyNbmI4IqwwJQzBJ
	 ZrkHEp1QbgKhU1t7U56ItLmFq0WRMZTATeqXyYMk=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F8A6385DC2E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F8A6385DC2E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709936803; cv=none;
 b=G6CC08bIFyyehb1actwdr/KwZChPCT5sF+8sbuEsbMuhwaCwQB0nA/AHlUq0Eo2SABFKm0Ub5KdsAjKZVQt1zV4vRXxV5B4FPHY4wjaQsrE4Tepm+zZoeypYuIb6ErVrWdI2DZYrJIOm9+1l12jDzpykEaBOOLR1VkeJHKmpzIo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1709936803; c=relaxed/simple;
 bh=dQzoMHqFpImSGKqHhd/9nq4qC2MDLvsedO7IZXAKtQI=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
 b=jhjayWzcsd5o5bPpwFYydDDiU9nbIlc+JW9Z7jN6q0f/TEONz22NO1S+2FdJxlrWGj6Y0uL8B0qk5ZUMBdfgK8RqeD7qEuVDUbxEwZ8XExwCxRo2Pe6x7d3yIAPcFaPpNjCCO6wIIJ8JKKAJh88sEthHUYDeRENOEK2p2bqFsWQ=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1709936799; x=1710541599;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=zHyKftjFwv/ydhwQl4oib2gQGxnA2r/2PILEf9OuKXQ=;
 b=q4JT5QryjURRXy+W+K4HiGXeaCHex2rGS1IMu7JHiJ9iab+mYuzCa+M4lziz+dhHbc
 3ie6St92Gy93Si2gkfoaMP8K6FvUxirehL4BkVku0Ym6lKa8KaM2yGxMmUaXDNyRtGPV
 e2UGNFadwbeLOjoR4EksxXx/mg1sECq4PG1gtur21u1kp+ckrBOt9NkigQMQXN/zBrBu
 oDdk+EAvCeXYjVr7M5gaIWZZ5IyQ1hs5Gl0TAvpoguiypuKoL8/v/iv8azSWM/M2NzIz
 wpojqU0+IAKF46NzyyO1WWFyA3pc2F314fLWV6F/Jr/T9BEL6u4bLCV8KN2/IPk2t+wv
 0Olg==
X-Gm-Message-State: AOJu0YxaqDB0BAMSEINjILDrxxscQxRFGv90g2F3p349yjmlP219mq1l
 n7HnCIucupgDwANPT/RwRwL73YdIq8kgb+qAL7gMSwYHr5jVdUTlKaMc+G2jtyKunA==
X-Google-Smtp-Source: AGHT+IHcuNIcYk+ATCLTXFx9IKYvsB9W/xeLi99SZi4Xvt1eqa+9Hb3s+IxUH6jGgwQ3A5noU1Nd8g==
X-Received: by 2002:a5e:df01:0:b0:7c8:6f1f:d44 with SMTP id
 f1-20020a5edf01000000b007c86f1f0d44mr313614ioq.1.1709936799423; 
 Fri, 08 Mar 2024 14:26:39 -0800 (PST)
Message-ID: <7d60a26c-1fa7-473e-94b7-1320e203131c@gmail.com>
Date: Fri, 8 Mar 2024 17:26:38 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: ls/stat on OneDrive causes download of files
Content-Language: en-CA
To: cygwin@cygwin.com, Jeffrey Altman <jaltman@secure-endpoints.com>,
        Thomas Wolff <towo@towo.net>
References: <CAC9GOO-RbcR5YOPyk6qVDuVSdDK4M=f1V8bHvz7yvoaHjGUZnQ@mail.gmail.com>
 <ZehuDAKd3ceXlfba@calimero.vinschen.de>
 <ZehvbhVizZTBSaRR@calimero.vinschen.de>
 <208962d1-78cd-4e2d-9e4a-a1edcbf5e809@SystematicSW.ab.ca>
 <ZeilkJK7Csryuzkc@calimero.vinschen.de>
 <7d9fe460-5704-424b-a89b-e34ef2176d38@secure-endpoints.com>
 <ZerqWzAr3b_mpork@calimero.vinschen.de>
 <a5ed70b0-8ac4-453f-b5cf-ce8f77f6bdf7@towo.net>
 <64b65385-cad3-4807-b6c3-e463507da164@secure-endpoints.com>
 <ZesZCFdvz4uxLjKg@calimero.vinschen.de>
 <ZeuPT82dRN2RfzHi@calimero.vinschen.de>
In-Reply-To: <ZeuPT82dRN2RfzHi@calimero.vinschen.de>
X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
 SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Marcin Wisnicki via Cygwin <cygwin@cygwin.com>
Reply-To: Marcin Wisnicki <mwisnicki@gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 428MRgoH501678

On 2024-03-08 17:21, Corinna Vinschen wrote:
> On Mar  8 14:56, Corinna Vinschen via Cygwin wrote:
>> On Mar  8 08:15, Jeffrey Altman via Cygwin wrote:
>>> On 3/8/2024 7:52 AM, Thomas Wolff via Cygwin wrote:
>>>> Am 08.03.2024 um 11:37 schrieb Corinna Vinschen via Cygwin:
>>>>>     FILE_OPEN_NO_RECALL (0x00400000)
>>>>> [...]
>>>>> This sounds like we could simply add this flag to all NtOpenFile
>>>>> used for path conversion or stat-like calls, without having to care
>>>>> for any file attributes specificially.
>>>>>
>>>>> Does that make sense?
>>>> Sounds good, without even studying the other details...
>>>> I speculate some more handling would still be needed to avoid executable
>>>> detection via magic tags.
>>>>
>>> Agreed.   FILE_OPEN_NO_RECALL has been defined for at least a decade but was
>>> not documented by Microsoft relatively recently.
>> Thanks for the feedback, guys.
>>
>>> Another suggestion would be to try opening the file with
>>> FILE_READ_ATTRIBUTES instead of GENERIC_READ if the file data is not
>>> required.  See
>>>
>>> https://github.com/microsoft/BuildXL/commit/4fb8e7ce07d243ccd95de0d66da551538a794493
>> Cygwin uses the minimum of required permissions in NtCreateFile/
>> NtOpenFile calls anyway.
>>
>> I'm just running a test cygwin DLL locally with a lot of added
>> FILE_OPEN_NO_RECALL bits and a couple of added attribute checks for
>> being offline to allow skipping some code.
>>
>> I think I'll push this change in a bit so we get a test release out
>> so people using OneDrive can test.
> I pushed this change as well as a followup change to make sure we don't
> inadvertently recall an offline file.  I also added handling for the
> Pinned and Unpinned attributes to chattr(1) and lsattr(1).
>
> The full set of changes can be tested by installing the Cygwin test
> release 3.6.0-0.77.g06aa5a751682.
>
> Please give it a try.  If you encounter a situation which still results
> in recalling an offline file in a situation which doesn't qualify for
> it, please report.  We will have to analyze that situation further
> then.
>
>
> Thanks,
> Corinna

Thanks for doing this work so quickly. I'm not subscribed to this 
mailing list so I didn't see previous messages.

I will try to check this in Cygwin this weekend but should tell you that 
I'm not cygwin user and now found a report of another user claiming this 
only happens in MSys and not in Cygwin.

https://github.com/msys2/MSYS2-packages/issues/3049


-- 
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

