X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6953385E008
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1710016217;
	bh=SwBR/SWRuMb1NNoAa7N2NNdhk3T/RGqwYKkRcyJNyoY=;
	h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=Tfmc80UXaKcbxB6wmjfTWsseZxkNQEuCC4TqnqcbiEJynkqACpvUmr4HJODtBUrn5
	 bRaDlZmGrgOIb76owffcm7ksA2VB+R2/4Sz1hjeUF6mHUKu5kcsYlC/HLRxlPh8R42
	 jptnaBDL5dgaxCkMuZ1n4nir5MmaZv09g6AFyOSI=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 480563858402
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 480563858402
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710016170; cv=none;
 b=P0fUpsB70z0ULiBvOQDVGP3ibd70CVsT/g+kdOoHNBgG+Qk61wmJ7zYWTy5jqduuejl/Gb0O5haaqxTkLdICvqdQeaLIy//5zhJnsm6tDjwHGH2dXc22XYsEXZHZfDx98W/bxdOuZMhBoT7m2KNcDrmq/qETv85nnIqEosK2rPo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1710016170; c=relaxed/simple;
 bh=2R1LE3VsdXMLOv2401WzyvZT1PnAmV11QYllMvTc/uM=;
 h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
 b=lvOaxmOeuPFhsbq+1hmAgn23+QgWP58MJbd2L4r9KGB3oCBlavyalUwJjuCizsGc+lK8XRSVbYuwaJ51NITZYYb2P6/SAMGB6FAkYaRNaKizHeExvQuQzbCrrTDdUNollno7ObA/Kw1F+9G3ADaLag0R57+Sl6KYwT8feHLrih0=
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=1710016164; x=1710620964;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=i1xUGaMaZgF7SIohjBfbQZRfs4LRjNRxAcaaBQq9I5I=;
 b=WtA0ZGQ5ojPsworriBMiLgEmIJdYTOorK4AEpQ2n11wQYXetw6xLpWaioLjpxvCCOZ
 YfsF70dZyIQ6qR6f+vuAtpDoNVDgNv/ywpOBPjjII9wPPS0FB1nmJ/DXoeR9CBKTXgPJ
 hQYF72DnNdNlhYI3KHY/64q6J+vF3CCDDxWgJPqz3SD+8b5V1lrnahPxyoqYw3B/REvi
 lxh+QCogI0aqcBqHmzAxQttq+Tq30KXnWM+T+rkC+mfLQCe2vG4rT00exZ07CLK5ovwt
 ZFyXzUF42xUB28qerhh/3U1/7b+LCFapCsyMB7TQlryfmxc4tksV/4fSMg5o1n7LrwTW
 uZ1g==
X-Gm-Message-State: AOJu0YwGEqT810lRhm+10Iayl+T27ufMYuuYtX9laK5iB7Jr13xwTCWY
 4RCb1X05aWmHm3crm1IOUkwr2NeNfiUmyqAs6o81qscsvcW+PhQ+3zk6Wfdgdsaw9jHr6hR8BP2
 5IYxoK5GbrRzPoDoOX9HKLdd+PkSvP+Lv6i3sCA==
X-Google-Smtp-Source: AGHT+IEt46OEJ05ULFZwf6BcyJZFE9mR3mttGk8IRzjRtVtoBBhe6x2T4ScRHV3yRqDZWpPF9+fuox8sfDSPnE29f9o=
X-Received: by 2002:a17:907:775a:b0:a45:bde4:c131 with SMTP id
 kx26-20020a170907775a00b00a45bde4c131mr1452644ejc.6.1710016164095; Sat, 09
 Mar 2024 12:29:24 -0800 (PST)
MIME-Version: 1.0
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>
 <7d60a26c-1fa7-473e-94b7-1320e203131c@gmail.com>
In-Reply-To: <7d60a26c-1fa7-473e-94b7-1320e203131c@gmail.com>
Date: Sat, 9 Mar 2024 15:29:13 -0500
Message-ID: <CAC9GOO9pSciz=ss_RKdOoATOML_H9+DWEyyXyRSZnr7ki+_OsQ@mail.gmail.com>
Subject: Re: ls/stat on OneDrive causes download of files
To: cygwin@cygwin.com, Jeffrey Altman <jaltman@secure-endpoints.com>,
        Thomas Wolff <towo@towo.net>
X-Spam-Status: No, score=-0.3 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="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

I did more testing and found out that the problem does not happen in
cygwin by default because cygwin mounts with acl which doesn't do
header sniffing while msys uses noacl.

Testing on an mp4 file in OneDrive, when I use noacl in cygwin it
triggers the read as well.
After upgrading to the test version the read is gone and an mp4 file
is not executable.

Thank you!

On Fri, 8 Mar 2024 at 17:26, Marcin Wisnicki <mwisnicki@gmail.com> wrote:
>
> 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
