X-Recipient: archive-cygwin@delorie.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:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=UXe/my/2uhIKC7NK
	qAruCdUB6zFL9R6Wta42Gc+HZ1VeapRHxocYHvksh2FPuS5GbmcsXT/FrIeoMpZb
	WuaisXU7hnLaS4KFM2D8NZVv7MkRApFFx1/PQwNpO0glYC+9UV7Sw76L/Z5D2s4I
	az9jJA5oPkUzZ+PJHGDOHRp1PHk=
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:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=jZQ/wKM9/o5P7DI3945JY9
	Xgi9w=; b=rHEqptKRKiu/xC3mtheeuJLQEX03uLiI2zii5xrhdD8/ZOIlKgFokQ
	tI1/u5ijpzdWdD4qz8s9GQyUDBvYsJutZZQ8sG6eF3MTcsjlzoPVdsDgoT6pT+pj
	VZ56HSHsYBV0SL/knCR/j9+IB5fKOFIDcILb+PK39SkXtoIdUcDqQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss@cs.umass.edu
Subject: Re: find command seems to lock files
To: cygwin@cygwin.com
References: <CA+7cx1rwShfSJYJZdvSF-8ERaAQqcYxtQquKKB8xwoBxqhLVog@mail.gmail.com> <20190819140308.GN11632@calimero.vinschen.de> <609c28ca-07da-f150-139b-267448ede826@cs.umass.edu> <20190819141321.GO11632@calimero.vinschen.de> <CA+7cx1rZyYwdeGSJFKdzvw_Rjm_4shVY+B-3c0DJmBcqXvjuNA@mail.gmail.com> <1621839017.20190819194256@yandex.ru> <CA+7cx1ooYni5-rxMZd8DYWKMkrEz56Ui-+xbPUY+-HJKbRdMDg@mail.gmail.com>
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <fc144ea3-afc0-0671-c174-1f95e3c18bdb@cs.umass.edu>
Date: Mon, 19 Aug 2019 13:41:53 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <CA+7cx1ooYni5-rxMZd8DYWKMkrEz56Ui-+xbPUY+-HJKbRdMDg@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes

On 8/19/2019 1:21 PM, Morten Kjærulff wrote:
 > 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?
I wouldn't say it _opens_ the file, but I read through the Posix man
page for stat/lstat/fstatat and it reveals that those calls update
the last access time in the inode, so that access the file "more"
than just getting some information from the directory.

 > Will
 > find /xx -type f -iname "zzz" -mtime +10s -execdir 'msg * "Achtung
 > programme crash boom!"'
 > not open the file to get the timestamp?

It still needs to look at the timestamps, and presumably
needs stat to do that.  All you can get from the directory
proper is the inode number and the name, I believe.  That is
not even enough for find to know whether it has to recurse
into the thing (is it a directory or not?), so I suspect
that find always does a stat call on every entry.

Regards - EM

--
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

