delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/08/17:22:05

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D39B385E458
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709936523;
bh=De1EB2FGqV1pz1N5bRwBWB41EsfrEwpNy6nBZ5lo89M=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=it1BuoGZF96ZMorL6+AVaZPQT/ea/Em2bF472Pi5tqEBA161kw7tbd92zoJOtcHXr
vqksFhFCwqxjH+M7FjixscxF+VE9IZ6erUqJzAu64MjCd/9fZChEY2Dz1qmj+nuwja
DrS/Bo7e++ejNtqxlhP1PSizVSAb8t/Zd7LjjK+I=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 657013858D38
Date: Fri, 8 Mar 2024 23:21:03 +0100
To: Marcin Wisnicki <mwisnicki AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: ls/stat on OneDrive causes download of files
Message-ID: <ZeuPT82dRN2RfzHi@calimero.vinschen.de>
Mail-Followup-To: Marcin Wisnicki <mwisnicki AT gmail DOT com>, cygwin AT cygwin DOT com,
Jeffrey Altman <jaltman AT secure-endpoints DOT com>,
Thomas Wolff <towo AT towo DOT net>
References: <CAC9GOO-RbcR5YOPyk6qVDuVSdDK4M=f1V8bHvz7yvoaHjGUZnQ AT mail DOT gmail DOT com>
<ZehuDAKd3ceXlfba AT calimero DOT vinschen DOT de>
<ZehvbhVizZTBSaRR AT calimero DOT vinschen DOT de>
<208962d1-78cd-4e2d-9e4a-a1edcbf5e809 AT SystematicSW DOT ab DOT ca>
<ZeilkJK7Csryuzkc AT calimero DOT vinschen DOT de>
<7d9fe460-5704-424b-a89b-e34ef2176d38 AT secure-endpoints DOT com>
<ZerqWzAr3b_mpork AT calimero DOT vinschen DOT de>
<a5ed70b0-8ac4-453f-b5cf-ce8f77f6bdf7 AT towo DOT net>
<64b65385-cad3-4807-b6c3-e463507da164 AT secure-endpoints DOT com>
<ZesZCFdvz4uxLjKg AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <ZesZCFdvz4uxLjKg@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: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin 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 428MM4DP500084

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

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