X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=VFw52H267PgdHhkKpk0ZJAVhPJzN7ziGDMz0MmuKfuPNswsZmGsy7 mWXBn9i4xa7N0gxgPG3SJ4DoumrbDEh92uQe8TEE0vwQLuqJjOhamqd2TUGvO44i dLtasPAaWT8BL7//wHKIvfbndSrEeYy68H7YgpvC/Qnr82TQcwL5G4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=/InI+tJY2OoLxSmlAL8tYk5LZ4Q=; b=wwWAaK892iHd0pEVRrv97QGFOPIB sGUfJtgYHINYzKdZC44P5cbrtJr3XtnT/1/zZChKS9PE065V665wNB74I+WkzYos 6y83H486OPxpw2GHJmjW9ZfnsfjkbNLTqHxFltipbLLJeGuOH5nKrTlQ3k3yKNZt lKsJsxkMlhmqekc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-101.7 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com X-HELO: mout.kundenserver.de Date: Mon, 19 Aug 2019 16:13:21 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: find command seems to lock files Message-ID: <20190819141321.GO11632@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20190819140308 DOT GN11632 AT calimero DOT vinschen DOT de> <609c28ca-07da-f150-139b-267448ede826 AT cs DOT umass DOT edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EM2zIRCtNCod1hEe" Content-Disposition: inline In-Reply-To: <609c28ca-07da-f150-139b-267448ede826@cs.umass.edu> User-Agent: Mutt/1.11.3 (2019-02-01) --EM2zIRCtNCod1hEe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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, > > >=20 > > > I have an application which constantly: > > > creates a file > > > do some processing > > > deletes the file > > >=20 > > > One way to monitor if the application has crashed, is to check the ag= e of > > > the file, so I made a script that: > > >=20 > > > find //$server/d$/dir/subdir*/subsubdir -name 'thefile' -printf '%A+\= n' > > >=20 > > > subdir* will be subdir1 subdir2 ... > > > under subsubdir there will be dirA, dirB, ... and under those, thefil= e may > > > exist. > > >=20 > > > Problem is that it seems this command locks thefile, as the applicati= on > > > sometimes can't delete it. > > >=20 > > > Could this be true? > >=20 > > Cygwin does not actually lock anything except in very rare > > circumstances. Your problem is more likely triggered by a realtime > > virus scanner. >=20 > 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 --=20 Corinna Vinschen Cygwin Maintainer --EM2zIRCtNCod1hEe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1aroEACgkQ9TYGna5E T6BFFQ//e9zB4gC4Vmv18IX0IJ3ek5rx6bvWhBhLPIJAQnNjvcRrjt4BnqkH9lRF knqxyoqsAfG7tb+o6WpxdwNNJmU/1+d+vHVYRM+hF/dbABw+HaJbiGtavkS6Hr1p Y2mzUrk/sR0Qag+ylFuBfmTxW7RgOwleIL9uWneHZudfeZVJo6Kb89qbcc68rfMN 6dvS3OMGH+OzoO510eAOyPOKqI8+/IrrXiu1C/ugENuDDGXlsyY1gVgCOr/lHdK8 vKhxsontcqwtZnf98mW/PQpdblIg649z/KvR9edc+MjrjUg3IRv+OezFeSlGFjfl 3HlL35PBfTefmPKp/cbQSnDnDQk8192joJymJekA+vrQ0qo+fg9kv2WwA2ZnF/b2 FGtLMerbXEJKqvgiz37ZCrT1WQ/2jC/jXIQ+WvVdfiklIxzsn95Uoyx/PuH8Igyt DBrbImDBF2RAZkoEYylmPfVAwDFLrNWkm/mv0h6pC5sdTE1vbwLlD818QHwhGHBy +EFq0i9q4zMy1QH8oA/smaBC1D0j09UqmQ9OxQMmB+39RnvJdp1fi5Wz+sAFsw1A Y/63OM9ljyH2g7dVZNqbfnLFy9QvZDLwHU9uOZO4aJXladNVLocaZVI63GS2ukoj qY2lToyBM3k4KCWe0Ae5XJtkTxpmx2oUw4yFKegXhIopgRgjq7I= =2ixq -----END PGP SIGNATURE----- --EM2zIRCtNCod1hEe--