From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 657013858D38; Fri, 8 Mar 2024 22:21:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 657013858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1709936465; bh=xy9OigsogV4h1b01XfddxSCUUHgnLylJU3cJ/ugS4Do=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=VDcbY6thgaGQsyMFg7WeiyDCT4pDRnmHc06zCsbTUIrcnAT37x8AGBUDhQ9wYrAkZ 0nnVKwq3CJ0SWdgBbDQIhbjZo1OIVgZC9cRv1byylsj9LK5ItuuX68A7SHGwT4WGM1 Mb5K/wt9XSveAFRXBNXBLwp5I0fyoUgpCDbjdP1A= Received: by calimero.vinschen.de (Postfix, from userid 500) id 5B77CA80B9F; Fri, 8 Mar 2024 23:21:03 +0100 (CET) Date: Fri, 8 Mar 2024 23:21:03 +0100 From: Corinna Vinschen To: Marcin Wisnicki , cygwin@cygwin.com Cc: Jeffrey Altman , Thomas Wolff Subject: Re: ls/stat on OneDrive causes download of files Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: Marcin Wisnicki , cygwin@cygwin.com, Jeffrey Altman , Thomas Wolff References: <208962d1-78cd-4e2d-9e4a-a1edcbf5e809@SystematicSW.ab.ca> <7d9fe460-5704-424b-a89b-e34ef2176d38@secure-endpoints.com> <64b65385-cad3-4807-b6c3-e463507da164@secure-endpoints.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: 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