From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 480563858402 for ; Sat, 9 Mar 2024 20:29:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 480563858402 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 480563858402 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::530 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 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5668db0720fso757200a12.0 for ; Sat, 09 Mar 2024 12:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710016164; x=1710620964; darn=cygwin.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=i1xUGaMaZgF7SIohjBfbQZRfs4LRjNRxAcaaBQq9I5I=; b=FlTRbEZntOPW8wvrPg+Pdn/eBvvOucNGTJtkGNWKEHDJSId7eEWjZAcYFnOnhVaexn aRH0kFNhQnNsLWb+nxlkS0kX0T9n2p8S1MZYotZjlP5bKXpYd3s44WKND0qHkMNbfTKT xOijH1ituUFA7/1zmNZTeer5utWoiASAv46DQ4usRnYCM1SL/ShIOpNxlqwetjF2Uigx kup2o6s+GPHIvcDhxVTgfQzWdzbkBQfE2OP6k/MEuAROptfOCwThqGeuoNthEBa3X+Zr C5UTnJbUMwHense1m8CjGcJXt+napmBrhRPtFkyBfZi6RXZGhaF0l0d/l61mrp+0nMk2 hMWA== 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: <208962d1-78cd-4e2d-9e4a-a1edcbf5e809@SystematicSW.ab.ca> <7d9fe460-5704-424b-a89b-e34ef2176d38@secure-endpoints.com> <64b65385-cad3-4807-b6c3-e463507da164@secure-endpoints.com> <7d60a26c-1fa7-473e-94b7-1320e203131c@gmail.com> In-Reply-To: <7d60a26c-1fa7-473e-94b7-1320e203131c@gmail.com> From: Marcin Wisnicki Date: Sat, 9 Mar 2024 15:29:13 -0500 Message-ID: Subject: Re: ls/stat on OneDrive causes download of files To: cygwin@cygwin.com, Jeffrey Altman , Thomas Wolff Content-Type: text/plain; charset="UTF-8" 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 List-Id: 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 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 >