From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48379 invoked by alias); 19 Aug 2019 14:26:36 -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 48371 invoked by uid 89); 19 Aug 2019 14:26:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2311 X-HELO: mail-qk1-f177.google.com Received: from mail-qk1-f177.google.com (HELO mail-qk1-f177.google.com) (209.85.222.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Aug 2019 14:26:35 +0000 Received: by mail-qk1-f177.google.com with SMTP id r21so1551454qke.2 for ; Mon, 19 Aug 2019 07:26:34 -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=/zj0WvABKJHODG5lqOkXI30taP5jyxEVbtuWj03rOA8=; b=fsf1wsgsOnJa02ModmryZFlRn3PNd26Yr9sFmEg5qTVvZTgZ2kzTgrJy6MubSyio8V CwMqARL/z5l+DbAEzydYOj7S/wS4lVumoxcE/v4e+S7z3speDdzfdAiMi9VPYCITuJ4Y D8HsXHCJ3gwlEwxQx4FIFB+iD+t05CLLTYG466G+gOBx7T62qgQos+IqzYGBBcLJ1o5m J02ougVQ0BSMrPk1k8GvbBmkoVH9X9DyLnSv8tMskFnDTHJNwD0xhYftz8NTtbd1TEBC vKNvCWMRtWA/xKPG1XO5Qe/o2yTfGjzALXzF9LyaTJ0iUSp7Sk+QigvO1IO6ITMvnG7q 0juw== MIME-Version: 1.0 References: <20190819140308.GN11632@calimero.vinschen.de> <609c28ca-07da-f150-139b-267448ede826@cs.umass.edu> <20190819141321.GO11632@calimero.vinschen.de> In-Reply-To: <20190819141321.GO11632@calimero.vinschen.de> From: =?UTF-8?Q?Morten_Kj=C3=A6rulff?= Date: Mon, 19 Aug 2019 14: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/msg00281.txt.bz2 On Mon, Aug 19, 2019 at 4:13 PM Corinna Vinschen wrote: > > On Aug 19 10:06, Eliot Moss wrote: > > On 8/19/2019 10:03 AM, Corinna Vinschen wrote: > > > On Aug 19 14:33, Morten Kj=C3=A6rulff wrote: > > > > Hi, > > > > > > > > I have an application which constantly: > > > > creates a file > > > > do some processing > > > > deletes the file > > > > > > > > One way to monitor if the application has crashed, is to check the = age of > > > > the file, so I made a script that: > > > > > > > > find //$server/d$/dir/subdir*/subsubdir -name 'thefile' -printf '%A= +\n' > > > > > > > > subdir* will be subdir1 subdir2 ... > > > > under subsubdir there will be dirA, dirB, ... and under those, thef= ile may > > > > exist. > > > > > > > > Problem is that it seems this command locks thefile, as the applica= tion > > > > sometimes can't delete it. > > > > > > > > Could this be true? > > > > > > Cygwin does not actually lock anything except in very rare > > > circumstances. Your problem is more likely triggered by a realtime > > > virus scanner. > > > > I was wondering, though, whether the parent directory would > > be non-delete-able while find has the directory open for scanning. > > Usually yes. Cygwin moves the entire directory into the recycler in > case it's a local dir. That works even if a file is blocking the > dir from deletion. > > > 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 API > and if some other process opens a file these scanners open the file as > well, typically without FILE_SHARE_DELETE, which Cygwin uses by default. > > > 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). /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