From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63754 invoked by alias); 19 Aug 2019 17:21:48 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 63747 invoked by uid 89); 19 Aug 2019 17:21:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=Greetings, lo X-HELO: mail-qk1-f182.google.com Received: from mail-qk1-f182.google.com (HELO mail-qk1-f182.google.com) (209.85.222.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Aug 2019 17:21:47 +0000 Received: by mail-qk1-f182.google.com with SMTP id d23so2075353qko.3 for ; Mon, 19 Aug 2019 10:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=qeGo5xtDTKfQ/mgLies4c21+Zahq7MF2PIQDCf9W/Co=; b=KwAm8cOKKMLqc5vWoTqfPNF1b6OHyu23/bV/3+cjKiJoyJS7SnjN1UTG30wjMadbsk b+BKeNOIp4wTX63j+e5eRtJ6BukwU85qHXvMB0quf9wlnxQk7wG9ysXP0v8tVvSEKuIk qhoe/C80kd7+sSntrPIrTsvPhL9APD3BWBjq+S38gcD3hobnNdRhDFCR+O65BXTulhPR +R042AeHzlU6dJdNSQKI0/nT/JSuFIrWsVNn3jtPaehuiz3wMmMflyJ51c5sL/kAZi1a IBFhPSrc9o7Exqg3nNdeQvuNGyy81oW94KgSl2IQKnJn99z5ebS/ScPSMBX4+J2mYwHW Jiyg== MIME-Version: 1.0 References: <20190819140308.GN11632@calimero.vinschen.de> <609c28ca-07da-f150-139b-267448ede826@cs.umass.edu> <20190819141321.GO11632@calimero.vinschen.de> <1621839017.20190819194256@yandex.ru> In-Reply-To: <1621839017.20190819194256@yandex.ru> From: =?UTF-8?Q?Morten_Kj=C3=A6rulff?= Date: Mon, 19 Aug 2019 17:41:00 -0000 Message-ID: Subject: Re: find command seems to lock files To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00288.txt.bz2 On Mon, Aug 19, 2019 at 6:50 PM Andrey Repin wrote: > > Greetings, Morten Kj=C3=A6rulff! > > >> > >> > If the application in question creates and deletes the parent > >> > directory, as well as the leaf file, then things would be left > >> > around unexpectedly. > >> > >> The question was just if the file is locked. > >> > >> > So would use of find trigger a virus scanner, which in turn might > >> > hold on to the file and prevent its deletion? > >> > >> That's how some realtime scanners work. They have hooks in the file A= PI > >> and if some other process opens a file these scanners open the file as > >> well, typically without FILE_SHARE_DELETE, which Cygwin uses by defaul= t. > >> > >> > >> Corinna > >> > >> -- > >> Corinna Vinschen > >> Cygwin Maintainer > > > I forgot to say that I run the find command on my own PC, and the > > application runs on a server, which I have 'net use' its disk. > > > Would it be the virus scanner on my PC or on the server? > > Any idea of a different way to get the age of the file? (I am sure I > > cannot change the virus scanner). > > To begin with, the results of your `find` calls will be at least 5 seconds > stale over CIFS share with default settings. > Said that, you could safely write something like > > find /xx -type =D0=B0 -iname "zzz" -mtime +10s -execdir 'msg * "Achtung p= rogramme crash boom!"' > > In regard to antivirus, > > 1. first make sure your local AV does not scan network directories by def= ault. > This is a gigantic usability issue for multiple reasons and normally is n= ever done. > 2. if possible, check what exactly happens when your program lo=D1=81ks u= p. > Yes, as said above, find will lock /directories/ it is scanning. > This is how Windows filesystem API works. > But it should not lock files by itself. > > > -- > With best regards, > Andrey Repin > Monday, August 19, 2019 19:36:25 > > Sorry for my terrible english... Thanks. I guess that the reason find opens the file (and thereby trigger antivirus) is because I print the files timestamp (-printf '%A+\n'), right? If I just printed the filename, the file would not be opened, right? Will find /xx -type f -iname "zzz" -mtime +10s -execdir 'msg * "Achtung programme crash boom!"' not open the file to get the timestamp? /Morten -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple