From unknown Sat Aug 16 15:56:38 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18406 <18406@debbugs.gnu.org> To: bug#18406 <18406@debbugs.gnu.org> Subject: Status: O_NOATIME patch Reply-To: bug#18406 <18406@debbugs.gnu.org> Date: Sat, 16 Aug 2025 22:56:38 +0000 retitle 18406 O_NOATIME patch reassign 18406 grep submitter 18406 starlight.2014q3@binnacle.cx severity 18406 wishlist tag 18406 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 04 17:38:05 2014 Received: (at submit) by debbugs.gnu.org; 4 Sep 2014 21:38:06 +0000 Received: from localhost ([127.0.0.1]:59089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPejF-0004rY-0t for submit@debbugs.gnu.org; Thu, 04 Sep 2014 17:38:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33559) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPeHY-0004B7-VD for submit@debbugs.gnu.org; Thu, 04 Sep 2014 17:09:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPeHS-00026F-W5 for submit@debbugs.gnu.org; Thu, 04 Sep 2014 17:09:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPeHS-000262-Sw for submit@debbugs.gnu.org; Thu, 04 Sep 2014 17:09:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPeHS-000196-1C for bug-grep@gnu.org; Thu, 04 Sep 2014 17:09:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPeHR-00022p-9S for bug-grep@gnu.org; Thu, 04 Sep 2014 17:09:21 -0400 Received: from mx.binnacle.cx ([2001:470:885c:87::18]:45964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPeHR-00020e-3V for bug-grep@gnu.org; Thu, 04 Sep 2014 17:09:21 -0400 Received: from CIANNAIT.binnacle.cx (ciannait [172.29.87.10]) by mx.binnacle.cx (envelope-from ) (8.14.9/8.14.9) with ESMTP id s84KkS0u011648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 4 Sep 2014 16:46:29 -0400 Message-Id: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> Date: Thu, 04 Sep 2014 16:46:27 -0400 To: bug-grep@gnu.org From: starlight.2014q3@binnacle.cx Subject: O_NOATIME patch Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_1027590036==_" X-Scanned-By: MIMEDefang 2.75 on 172.29.87.18 Received-SPF: pass (mx.binnacle.cx: 172.29.87.10 is whitelisted by SPF-milter whitelist entry) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 04 Sep 2014 17:38:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) --=====================_1027590036==_ Content-Type: text/plain; charset="us-ascii" Wrote a quick (but clean) patch to have O_NOATIME applied on file opens. I find this handy for bulk find/grep when I'd prefer not to update atime. If the patch is of interest I'm willing to improve it by having the feature present conditionally on the appearance of HAVE_WORKING_O_NOATIME in 'config.h'. Perhaps my choice of -N or --no-atime are not agreeable to all. Possibly the option does not belong under "miscellaneous." Easy to change. --=====================_1027590036==_ Content-Type: application/octet-stream; name="grep-noatime.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="grep-noatime.patch" LS0tIHNyYy9ncmVwLmMuYXIJMjAxNC0wNS0zMSAxMDozNTozNC4wMDAwMDAw MDAgLTA0MDAKKysrIHNyYy9ncmVwLmMJMjAxNC0wOS0wNCAxMzo1Nzo1NC44 MTE2MDI0MTQgLTA0MDAKQEAgLTI3NCw3ICsyNzQsNyBAQAogc3RhdGljIHN0 cnVjdCBleGNsdWRlICpleGNsdWRlZF9kaXJlY3RvcnlfcGF0dGVybnM7CiAv KiBTaG9ydCBvcHRpb25zLiAgKi8KIHN0YXRpYyBjaGFyIGNvbnN0IHNob3J0 X29wdGlvbnNbXSA9Ci0iMDEyMzQ1Njc4OUE6QjpDOkQ6RUZHSElQVFVWWDph YmNkOmU6ZjpoaUxsbTpub3FScnN1dnd4eVp6IjsKKyIwMTIzNDU2Nzg5QTpC OkM6RDpFRkdISU5QVFVWWDphYmNkOmU6ZjpoaUxsbTpub3FScnN1dnd4eVp6 IjsKIAogLyogTm9uLWJvb2xlYW4gbG9uZyBvcHRpb25zIHRoYXQgaGF2ZSBu byBjb3JyZXNwb25kaW5nIHNob3J0IGVxdWl2YWxlbnRzLiAgKi8KIGVudW0K QEAgLTM0Myw2ICszNDMsOCBAQAogICB7InZlcnNpb24iLCBub19hcmd1bWVu dCwgTlVMTCwgJ1YnfSwKICAgeyJ3aXRoLWZpbGVuYW1lIiwgbm9fYXJndW1l bnQsIE5VTEwsICdIJ30sCiAgIHsid29yZC1yZWdleHAiLCBub19hcmd1bWVu dCwgTlVMTCwgJ3cnfSwKKworICB7Im5vLWF0aW1lIiwgbm9fYXJndW1lbnQs IE5VTEwsICdOJ30sCiAgIHswLCAwLCAwLCAwfQogfTsKIApAQCAtMTM0OSwx MCArMTM1MSwxNyBAQAogICByZXR1cm4gZ3JlcGZpbGUgKGRpcmRlc2MsIGVu dC0+ZnRzX2FjY3BhdGgsIGZvbGxvdywgY29tbWFuZF9saW5lKTsKIH0KIAor c3RhdGljIGludCBub19hdGltZTsKKwogc3RhdGljIGludAogZ3JlcGZpbGUg KGludCBkaXJkZXNjLCBjaGFyIGNvbnN0ICpuYW1lLCBpbnQgZm9sbG93LCBp bnQgY29tbWFuZF9saW5lKQogewotICBpbnQgZGVzYyA9IG9wZW5hdF9zYWZl ciAoZGlyZGVzYywgbmFtZSwgT19SRE9OTFkgfCAoZm9sbG93ID8gMCA6IE9f Tk9GT0xMT1cpKTsKKyAgaW50IGRlc2MgPSBvcGVuYXRfc2FmZXIgKGRpcmRl c2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lLAorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBPX1JET05MWQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgfCAoZm9sbG93ID8gMCA6IE9fTk9GT0xMT1cpCisg ICAgICAgICAgICAgICAgICAgICAgICAgICB8IChub19hdGltZSA/IE9fTk9B VElNRSA6IDApCisgICAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgIGlm IChkZXNjIDwgMCkKICAgICB7CiAgICAgICBpZiAoZm9sbG93IHx8IChlcnJu byAhPSBFTE9PUCAmJiBlcnJubyAhPSBFTUxJTkspKQpAQCAtMTU1Myw2ICsx NTYyLDcgQEAKICAgLXMsIC0tbm8tbWVzc2FnZXMgICAgICAgICBzdXBwcmVz cyBlcnJvciBtZXNzYWdlc1xuXAogICAtdiwgLS1pbnZlcnQtbWF0Y2ggICAg ICAgIHNlbGVjdCBub24tbWF0Y2hpbmcgbGluZXNcblwKICAgLVYsIC0tdmVy c2lvbiAgICAgICAgICAgICBkaXNwbGF5IHZlcnNpb24gaW5mb3JtYXRpb24g YW5kIGV4aXRcblwKKyAgLU4sIC0tbm8tYXRpbWUgICAgICAgICAgICBvcGVu IGZpbGVzIHdpdGggT19OT0FUSU1FXG5cCiAgICAgICAtLWhlbHAgICAgICAg ICAgICAgICAgZGlzcGxheSB0aGlzIGhlbHAgdGV4dCBhbmQgZXhpdFxuIikp OwogICAgICAgcHJpbnRmIChfKCJcCiBcblwKQEAgLTIwNTEsNiArMjA2MSwx MCBAQAogICAgICAgICBzaG93X3ZlcnNpb24gPSAxOwogICAgICAgICBicmVh azsKIAorICAgICAgY2FzZSAnTic6CisgICAgICAgIG5vX2F0aW1lID0gMTsK KyAgICAgICAgYnJlYWs7CisKICAgICAgIGNhc2UgJ2EnOgogICAgICAgICBi aW5hcnlfZmlsZXMgPSBURVhUX0JJTkFSWV9GSUxFUzsKICAgICAgICAgYnJl YWs7Cg== --=====================_1027590036==_-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 11 16:00:23 2014 Received: (at control) by debbugs.gnu.org; 11 Sep 2014 20:00:23 +0000 Received: from localhost ([127.0.0.1]:38492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSAXW-0000j0-E3 for submit@debbugs.gnu.org; Thu, 11 Sep 2014 16:00:22 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:56230) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSAXT-0000io-6x for control@debbugs.gnu.org; Thu, 11 Sep 2014 16:00:20 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 0CD9DA60001 for ; Thu, 11 Sep 2014 13:00:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r+mfoRD8mXKY for ; Thu, 11 Sep 2014 13:00:09 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 7CB2DA6001E for ; Thu, 11 Sep 2014 13:00:09 -0700 (PDT) Message-ID: <5411FF49.1090207@cs.ucla.edu> Date: Thu, 11 Sep 2014 13:00:09 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: grep bug maintenance Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) close 18425 severity 18406 wishlist tags 18406 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 11 16:14:07 2014 Received: (at 18406) by debbugs.gnu.org; 11 Sep 2014 20:14:07 +0000 Received: from localhost ([127.0.0.1]:38501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSAkp-00016P-1x for submit@debbugs.gnu.org; Thu, 11 Sep 2014 16:14:07 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:56983) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSAkm-00016G-Ah for 18406@debbugs.gnu.org; Thu, 11 Sep 2014 16:14:05 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C5C64A6001B; Thu, 11 Sep 2014 13:14:03 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FHgLqtTyxtaB; Thu, 11 Sep 2014 13:13:55 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 1B776A6001E; Thu, 11 Sep 2014 13:13:55 -0700 (PDT) Message-ID: <54120282.3080304@cs.ucla.edu> Date: Thu, 11 Sep 2014 13:13:54 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: starlight.2014q3@binnacle.cx, 18406@debbugs.gnu.org Subject: Re: bug#18406: O_NOATIME patch References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> In-Reply-To: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 18406 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) > If the patch is of interest I'm willing > to improve it by having the feature > present conditionally on the appearance of > HAVE_WORKING_O_NOATIME > in 'config.h'. Thanks, but there's no need for that; just have 'grep' complain if the option is used and O_NOATIME == 0. I'm of two minds about this suggestion. On the one hand we don't want to add an option like this to every utility that reads files. On the other hand grep is used soooo often that it may be justifiable. What do other people think? If we add it, it should not have a single-letter option, though, and the long option should be called "--atime-preserve" for compatibility with tar, and the patch should also use FTS_NOATIME to avoid updating atime on directories with grep -r, and it should be documented properly in grep.texi and in 'grep --help' output and in NEWS (plus maybe write a test case or two....). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 11 16:50:24 2014 Received: (at 18406) by debbugs.gnu.org; 11 Sep 2014 20:50:24 +0000 Received: from localhost ([127.0.0.1]:38530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSBJw-0003KY-6p for submit@debbugs.gnu.org; Thu, 11 Sep 2014 16:50:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62712) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSBJs-0003KO-NV for 18406@debbugs.gnu.org; Thu, 11 Sep 2014 16:50:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8BKoBsW017027 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 11 Sep 2014 16:50:11 -0400 Received: from [10.3.113.7] ([10.3.113.7]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8BKoAVu010952; Thu, 11 Sep 2014 16:50:11 -0400 Message-ID: <54120B02.3030407@redhat.com> Date: Thu, 11 Sep 2014 14:50:10 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Paul Eggert , starlight.2014q3@binnacle.cx, 18406@debbugs.gnu.org Subject: Re: bug#18406: O_NOATIME patch References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> <54120282.3080304@cs.ucla.edu> In-Reply-To: <54120282.3080304@cs.ucla.edu> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UdG7P7cNa9vpO3wOmS4SMMqhFTFKRwPiK" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -7.5 (-------) X-Debbugs-Envelope-To: 18406 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.5 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UdG7P7cNa9vpO3wOmS4SMMqhFTFKRwPiK Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/11/2014 02:13 PM, Paul Eggert wrote: >> If the patch is of interest I'm willing >> to improve it by having the feature >> present conditionally on the appearance of >> HAVE_WORKING_O_NOATIME >> in 'config.h'. >=20 > Thanks, but there's no need for that; just have 'grep' complain if the > option is used and O_NOATIME =3D=3D 0. >=20 > I'm of two minds about this suggestion. On the one hand we don't want > to add an option like this to every utility that reads files. On the > other hand grep is used soooo often that it may be justifiable. What d= o > other people think? >=20 > If we add it, it should not have a single-letter option, though, and th= e > long option should be called "--atime-preserve" for compatibility with > tar, and the patch should also use FTS_NOATIME to avoid updating atime > on directories with grep -r, and it should be documented properly in > grep.texi and in 'grep --help' output and in NEWS (plus maybe write a > test case or two....). Lots of work, but I like the idea. In fact, I proposed a similar idea for coreutils' du several years ago, and the only reason I haven't actually submitted a patch is _because_ it is a lot of this detail work. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UdG7P7cNa9vpO3wOmS4SMMqhFTFKRwPiK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUEgsCAAoJEKeha0olJ0Nqh3sH/06q63KM4jmfgI6LA8hrnR12 m/sT/ZPEEQwcAcBTxbtg5m25q4TsztBLCprqOr6LFeUhfjrzLwAmEB7jFG6lC+Kb q1mhVc8PZB6Ge89s1UnSDsQ3a6EtXdLVbIVK/GrlAcxr58RF90e86R6J8JysDw+2 Z0Y60ii+19T4y/iMIa+W38spm9vK3QqvdQFZC5u3Z+4tC0eM4EWx6HejtpniC53c ZBorS5c11piUSOF4zH1ru47MPLcPYw6UlSZ69vXZianhoi5LAwJL7Jh+Grr/k2J9 6EXBzvBPNLPwQhIE3gWS6qVydSi/qq0/QPFy/oWoBUiYvjEvfKlonKtiAvQ2Hcg= =eQ5I -----END PGP SIGNATURE----- --UdG7P7cNa9vpO3wOmS4SMMqhFTFKRwPiK-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 11 17:52:31 2014 Received: (at 18406) by debbugs.gnu.org; 11 Sep 2014 21:52:31 +0000 Received: from localhost ([127.0.0.1]:38568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCI2-0007Qh-UE for submit@debbugs.gnu.org; Thu, 11 Sep 2014 17:52:31 -0400 Received: from mx.binnacle.cx ([74.95.187.105]:50466) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCI0-0007QU-9X for 18406@debbugs.gnu.org; Thu, 11 Sep 2014 17:52:29 -0400 Received: from CIANNAIT.binnacle.cx (ciannait [172.29.87.10]) by mx.binnacle.cx (envelope-from ) (8.14.9/8.14.9) with ESMTP id s8BLqJwI021775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Sep 2014 17:52:19 -0400 Message-Id: <6.2.5.6.2.20140911173356.0823c140@binnacle.cx> Date: Thu, 11 Sep 2014 17:43:52 -0400 To: Paul Eggert , Blake , 18406@debbugs.gnu.org From: starlight.2014q3@binnacle.cx Subject: Re: bug#18406: O_NOATIME patch In-Reply-To: <54120282.3080304@cs.ucla.edu> References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> <54120282.3080304@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -1 () ALL_TRUSTED X-Scanned-By: MIMEDefang 2.75 on 172.29.87.18 Received-SPF: pass (mx.binnacle.cx: 172.29.87.10 is whitelisted by SPF-milter whitelist entry) X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 18406 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) At 13:13 9/11/2014 -0700, Paul Eggert wrote: >> If the patch is of interest I'm willing >> to improve it by having the feature >> present conditionally on the appearance of >> HAVE_WORKING_O_NOATIME >> in 'config.h'. > >Thanks, but there's no need for that; just >have 'grep' complain if the option is used >and O_NOATIME == 0. Sure, that is a better approach. >I'm of two minds about this suggestion. On >the one hand we don't want to add an option >like this to every utility that reads >files. On the other hand grep is used soooo >often that it may be justifiable. What do >other people think? I don't feel a compulsion to utilize O_NOATIME all over the place--it really seems like a specific use case to me which is where one cares about and refers to ATIME with something like 'ls -otru' and one frequently runs find * -type f -print | xargs egrep somestring while trying to find code fragments. For years it has annoyed me that the 'find/grep' nukes ATIME values for the entire tree one is working on. >If we add it, it should not have a >single-letter option, though, and the long >option should be called "--atime-preserve" >for compatibility with tar, I specifically chose to not use the 'tar' option because it has two variants: a) =replace and b) =system in order to avoid semantic confusion. The 'tar' default is --atime-preserve=restore which nukes CTIME values and is evil in my opinion. But I don't feel strongly about the naming choice here. However I do feel strongly that a short option should be defined. If one embraces the feature it would be typed often. >and the patch >should also use FTS_NOATIME to avoid updating >atime on directories with grep -r, and it >should be documented properly in grep.texi >and in 'grep --help' output and in NEWS (plus >maybe write a test case or two....). I can do the above if a decision is taken to adopt the feature. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 11 18:15:52 2014 Received: (at 18406) by debbugs.gnu.org; 11 Sep 2014 22:15:53 +0000 Received: from localhost ([127.0.0.1]:38574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCee-000836-Gf for submit@debbugs.gnu.org; Thu, 11 Sep 2014 18:15:52 -0400 Received: from mx.binnacle.cx ([74.95.187.105]:50479) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCeb-00082w-Ci for 18406@debbugs.gnu.org; Thu, 11 Sep 2014 18:15:50 -0400 Received: from CIANNAIT.binnacle.cx (ciannait [172.29.87.10]) by mx.binnacle.cx (envelope-from ) (8.14.9/8.14.9) with ESMTP id s8BMFlRh021905 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Sep 2014 18:15:47 -0400 Message-Id: <6.2.5.6.2.20140911180420.082343b0@binnacle.cx> Date: Thu, 11 Sep 2014 18:08:38 -0400 To: Paul Eggert , Blake , 18406@debbugs.gnu.org From: starlight.2014q3@binnacle.cx Subject: Re: bug#18406: O_NOATIME patch Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -1 () ALL_TRUSTED X-Scanned-By: MIMEDefang 2.75 on 172.29.87.18 Received-SPF: pass (mx.binnacle.cx: 172.29.87.10 is whitelisted by SPF-milter whitelist entry) X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 18406 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) Another argument in favor of adding O_NOATIME support to a limited set of utilities (just 'grep' IMO) is that recent 'ext4' file system behavior defaults to a mode where ATIME is updated only once relative to a given MTIME. For O_NOATIME to be of use, one must care enough about ATIME to add 'strictatime' to the mount options in /etc/fstab. I find this matters to me only in the context of code development where seeing what has been recently viewed or compiled (mainly by me) is of interest. It's ok if ATIME is nuked wholesale on occasion since the usefulness of the value is short. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 22:21:23 2020 Received: (at 18406) by debbugs.gnu.org; 1 Sep 2020 02:21:23 +0000 Received: from localhost ([127.0.0.1]:54294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCvvG-00050m-L7 for submit@debbugs.gnu.org; Mon, 31 Aug 2020 22:21:23 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCvvD-00050T-0f for 18406@debbugs.gnu.org; Mon, 31 Aug 2020 22:21:21 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C6A9C160065; Mon, 31 Aug 2020 19:21:11 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LkezgKRUcSM4; Mon, 31 Aug 2020 19:21:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8D6E5160085; Mon, 31 Aug 2020 19:21:10 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Rakwh-w4y3Pu; Mon, 31 Aug 2020 19:21:10 -0700 (PDT) Received: from [192.168.1.9] (cpe-75-82-69-226.socal.res.rr.com [75.82.69.226]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DDD89160065; Mon, 31 Aug 2020 19:21:09 -0700 (PDT) Subject: Re: bug#18406: O_NOATIME patch From: Paul Eggert To: starlight.2014q3@binnacle.cx References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> <54120282.3080304@cs.ucla.edu> Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB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Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <54120282.3080304@cs.ucla.edu> Content-Type: multipart/mixed; boundary="------------E8D975F329F93695F49308F1" Content-Language: en-US X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: 18406 Cc: Eric Blake , 18406@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) This is a multi-part message in MIME format. --------------E8D975F329F93695F49308F1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/11/14 1:13 PM, Paul Eggert wrote: > Thanks, but there's no need for that; just have 'grep' complain if the option is > used and O_NOATIME == 0. On looking into this more today, O_NOATIME seems to be just a best-effort thing as some GNU/Linux filesystems ignore it, so grep should just join the throng and not worry whether O_NOATIME actually works. Also, the O_NOATIME support was withdrawn from fts a couple of years ago, so 'grep -r' can't easily avoid updating atime on directories. A patch is attached. I'm still of two minds about this. The efficiency argument for the new option is not as strong as it used to be, now that relatime has taken over on ext4 style filesystems. So the main argument is "I want to search through this directory but don't want it to count as an access"; although that's indeed a use case I'm not quite sure it's worth modifying 'grep' over. It doesn't seem to be worth using up a scarce option letter over, anyway, so the attached patch uses just a long option. --------------E8D975F329F93695F49308F1 Content-Type: text/x-patch; charset=UTF-8; name="0001-grep-new-atime-preserve-option.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-grep-new-atime-preserve-option.patch" >From f6506ab5ee58f37adc2c28c9be84e13a7467d935 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 31 Aug 2020 19:13:21 -0700 Subject: [PATCH] grep: new --atime-preserve option Suggested by starlight.2014q3 (Bug#18406). * NEWS, doc/grep.texi (Other Options): Mention it. * src/grep.c (ATIME_PRESERVE_OPTION): New constant. (binary): Remove, replacing with ... (open_flags): ... this new variable. All uses changed. The new variable also supports the new option. (long_options, grepfile, grep-command_line_arg, usage, main): Add support for new option. --- NEWS | 5 +++++ doc/grep.texi | 7 +++++++ src/grep.c | 32 +++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 5f4c0b4..14d436d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU grep NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + The new --atime-preserve option causes grep to not update the last + data access time of input data files, when possible. + ** Changes in behavior The --files-without-match (-L) option has reverted to its behavior diff --git a/doc/grep.texi b/doc/grep.texi index 02b1968..06452f3 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -774,6 +774,13 @@ and @file{file2}. Use line buffering on output. This can cause a performance penalty. +@item --atime-preserve +@opindex --atime-preserve +@cindex last data access +If possible, do not update the last data access time of input data +files. This option is silently ignored on platforms that always +update the timestamp. + @item -U @itemx --binary @opindex -U diff --git a/src/grep.c b/src/grep.c index 5764b2a..58af6ae 100644 --- a/src/grep.c +++ b/src/grep.c @@ -416,7 +416,8 @@ static char const short_options[] = /* Non-boolean long options that have no corresponding short equivalents. */ enum { - BINARY_FILES_OPTION = CHAR_MAX + 1, + ATIME_PRESERVE_OPTION = CHAR_MAX + 1, + BINARY_FILES_OPTION, COLOR_OPTION, EXCLUDE_DIRECTORY_OPTION, EXCLUDE_OPTION, @@ -438,6 +439,7 @@ static struct option const long_options[] = {"perl-regexp", no_argument, NULL, 'P'}, {"after-context", required_argument, NULL, 'A'}, {"before-context", required_argument, NULL, 'B'}, + {"atime-preserve", no_argument, NULL, ATIME_PRESERVE_OPTION}, {"binary-files", required_argument, NULL, BINARY_FILES_OPTION}, {"byte-offset", no_argument, NULL, 'b'}, {"context", required_argument, NULL, 'C'}, @@ -1033,7 +1035,7 @@ static intmax_t pending; /* Pending lines of output. static bool done_on_match; /* Stop scanning file on first match. */ static bool exit_on_match; /* Exit on first match. */ static bool dev_null_output; /* Stdout is known to be /dev/null. */ -static bool binary; /* Use binary rather than text I/O. */ +static int open_flags = O_RDONLY | O_NOCTTY; /* Flags to open input with. */ static void nlscan (char const *lim) @@ -1687,9 +1689,7 @@ open_symlink_nofollow_error (int err) static bool grepfile (int dirdesc, char const *name, bool follow, bool command_line) { - int oflag = (O_RDONLY | O_NOCTTY - | (IGNORE_DUPLICATE_BRANCH_WARNING - (binary ? O_BINARY : 0)) + int oflag = (open_flags | (follow ? 0 : O_NOFOLLOW) | (skip_devices (command_line) ? O_NONBLOCK : 0)); int desc = openat_safer (dirdesc, name, oflag); @@ -1888,7 +1888,13 @@ grep_command_line_arg (char const *arg) if (STREQ (arg, "-")) { filename = label; - if (binary) + if (open_flags & O_NOATIME) + { + int flags = fcntl (STDIN_FILENO, F_GETFL); + if (0 <= flags) + fcntl (STDIN_FILENO, F_SETFL, flags | O_NOATIME); + } + if (open_flags & O_BINARY) xset_binary_mode (STDIN_FILENO, O_BINARY); return grepdesc (STDIN_FILENO, true); } @@ -1936,6 +1942,7 @@ Pattern selection and interpretation:\n"), getprogname ()); printf (_("\ \n\ Miscellaneous:\n\ + --atime-preserve preserve last-access times on input files\n\ -s, --no-messages suppress error messages\n\ -v, --invert-match select non-matching lines\n\ -V, --version display version information and exit\n\ @@ -2532,8 +2539,7 @@ main (int argc, char **argv) break; case 'U': - if (O_BINARY) - binary = true; + open_flags |= O_BINARY; break; case 'u': @@ -2581,13 +2587,13 @@ main (int argc, char **argv) case 'f': if (STREQ (optarg, "-")) { - if (binary) + if (open_flags & O_BINARY) xset_binary_mode (STDIN_FILENO, O_BINARY); fp = stdin; } else { - fp = fopen (optarg, binary ? "rb" : "r"); + fp = fopen (optarg, open_flags & O_BINARY ? "rb" : "r"); if (!fp) die (EXIT_TROUBLE, errno, "%s", optarg); } @@ -2692,6 +2698,10 @@ main (int argc, char **argv) eolbyte = '\0'; break; + case ATIME_PRESERVE_OPTION: + open_flags |= O_NOATIME; + break; + case BINARY_FILES_OPTION: if (STREQ (optarg, "binary")) binary_files = BINARY_BINARY_FILES; @@ -2911,7 +2921,7 @@ main (int argc, char **argv) ? - (directories == RECURSE_DIRECTORIES) : 0 <= filename_option); - if (binary) + if (open_flags & O_BINARY) xset_binary_mode (STDOUT_FILENO, O_BINARY); /* Prefer sysconf for page size, as getpagesize typically returns int. */ -- 2.17.1 --------------E8D975F329F93695F49308F1-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 04 12:12:28 2020 Received: (at 18406) by debbugs.gnu.org; 4 Sep 2020 16:12:28 +0000 Received: from localhost ([127.0.0.1]:40469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEEKC-0008I6-0R for submit@debbugs.gnu.org; Fri, 04 Sep 2020 12:12:28 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEEKA-0008Hs-9m for 18406@debbugs.gnu.org; Fri, 04 Sep 2020 12:12:26 -0400 Received: by mail-wm1-f67.google.com with SMTP id a65so6546759wme.5 for <18406@debbugs.gnu.org>; Fri, 04 Sep 2020 09:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fbKv5lzpPsLQcGHtonrDcPVETrGo6bS/Cr8aO8tGqF4=; b=bEL5PbMbk14Bp4HL3XPz0CFo6M2cE9KEo30Wh+VDAgj3W6v/rodqJZxXoirgspYHZx XOvFcG5KITgghEh0/ELT2Ersyz8jL01vTKuic+1UuXkzqjEZGqAdPvATYFwwkVXBm4v0 XYQNXHIrfe98m5hR4pmIPvSOs8mhsigKVfI53G15tysEjaPCWy7070nPmoVttaNzWKnp pxSP0qiW5rZnu5t0IjH1y0U5b0HjOAseDKN8P0yt0W1/f/gUtCnwvWXLBsmcINacgvNg TPaCIMT5Zi45CuBilsXyKvd472/a3Lzjhlh/FCRqCsfkCkpbT7btR6VbZi+RarOIv9qD +kcQ== X-Gm-Message-State: AOAM530U5u5PpamVMIhvtcmsBb+qz8Z6qiT3MMSFumQvZNV5xNPin7CI 425LWM3fLBqF2j4HBxD324rn5945yf31R+AV/PI= X-Google-Smtp-Source: ABdhPJyQ6idW49SKDO39+Rf5LE3EiOpivVvSii0e049RX85iQKXDkvHYADzUtE9Bpaue3gf3YJMS90TefCzuhWeLfII= X-Received: by 2002:a05:600c:ce:: with SMTP id u14mr8662972wmm.137.1599235940381; Fri, 04 Sep 2020 09:12:20 -0700 (PDT) MIME-Version: 1.0 References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> <54120282.3080304@cs.ucla.edu> <73c8086f-43d0-1438-1d32-09f4c82e1e6c@cs.ucla.edu> In-Reply-To: <73c8086f-43d0-1438-1d32-09f4c82e1e6c@cs.ucla.edu> From: Jim Meyering Date: Fri, 4 Sep 2020 18:12:07 +0200 Message-ID: Subject: Re: bug#18406: O_NOATIME patch To: Paul Eggert Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18406 Cc: 18406@debbugs.gnu.org, starlight.2014q3@binnacle.cx X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Sep 1, 2020 at 4:22 AM Paul Eggert wrote: > On 9/11/14 1:13 PM, Paul Eggert wrote: > > Thanks, but there's no need for that; just have 'grep' complain if the option is > > used and O_NOATIME == 0. > > On looking into this more today, O_NOATIME seems to be just a best-effort thing > as some GNU/Linux filesystems ignore it, so grep should just join the throng and > not worry whether O_NOATIME actually works. > > Also, the O_NOATIME support was withdrawn from fts a couple of years ago, so > 'grep -r' can't easily avoid updating atime on directories. > > A patch is attached. I'm still of two minds about this. The efficiency argument > for the new option is not as strong as it used to be, now that relatime has > taken over on ext4 style filesystems. So the main argument is "I want to search > through this directory but don't want it to count as an access"; although that's > indeed a use case I'm not quite sure it's worth modifying 'grep' over. It > doesn't seem to be worth using up a scarce option letter over, anyway, so the > attached patch uses just a long option. I confess to similar ambivalence, but do like the idea. Has anyone run tests to compare performance on file systems like ext4, btrfs (the default with Fedora 33) and xfs? From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 04 13:43:21 2020 Received: (at 18406) by debbugs.gnu.org; 4 Sep 2020 17:43:21 +0000 Received: from localhost ([127.0.0.1]:40549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEFk9-0004I2-Cs for submit@debbugs.gnu.org; Fri, 04 Sep 2020 13:43:21 -0400 Received: from thorn.bewilderbeest.net ([71.19.156.171]:44224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEFk7-0004Hu-Pb for 18406@debbugs.gnu.org; Fri, 04 Sep 2020 13:43:20 -0400 Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 0857B806F7; Fri, 4 Sep 2020 10:43:17 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 thorn.bewilderbeest.net 0857B806F7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1599241398; bh=dbdUj5RQs+wtQY0P5HcowYVG7eDTbyxGznze69snvfo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hBFz95JYxp7PmbMAiLp/huvbLtjdyBWNTcOg5yJRjwdJkiDCKGMLThR1WTk8aD3oq SnWn3mf4n4jgN1Kop9nNGsp/cd4564KgPjYCAaHEEeFhAa+jcSPGukFjJZOqa8wP2d g+XBmPvVA8zUUOHWTUTtfERqncPWSJZlNBD2DsEc= Date: Fri, 4 Sep 2020 12:43:12 -0500 From: Zev Weiss To: Jim Meyering Subject: Re: bug#18406: O_NOATIME patch Message-ID: <20200904174312.rxn2kwyuw5jxs3vl@hatter.bewilderbeest.net> References: <6.2.5.6.2.20140904163056.072b70f0@flumedata.com> <54120282.3080304@cs.ucla.edu> <73c8086f-43d0-1438-1d32-09f4c82e1e6c@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18406 Cc: Paul Eggert , 18406@debbugs.gnu.org, starlight.2014q3@binnacle.cx X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, Sep 04, 2020 at 11:12:07AM CDT, Jim Meyering wrote: >On Tue, Sep 1, 2020 at 4:22 AM Paul Eggert wrote: >> On 9/11/14 1:13 PM, Paul Eggert wrote: >> > Thanks, but there's no need for that; just have 'grep' complain if the option is >> > used and O_NOATIME == 0. >> >> On looking into this more today, O_NOATIME seems to be just a best-effort thing >> as some GNU/Linux filesystems ignore it, so grep should just join the throng and >> not worry whether O_NOATIME actually works. >> >> Also, the O_NOATIME support was withdrawn from fts a couple of years ago, so >> 'grep -r' can't easily avoid updating atime on directories. >> >> A patch is attached. I'm still of two minds about this. The efficiency argument >> for the new option is not as strong as it used to be, now that relatime has >> taken over on ext4 style filesystems. So the main argument is "I want to search >> through this directory but don't want it to count as an access"; although that's >> indeed a use case I'm not quite sure it's worth modifying 'grep' over. It >> doesn't seem to be worth using up a scarce option letter over, anyway, so the >> attached patch uses just a long option. > >I confess to similar ambivalence, but do like the idea. Has anyone run >tests to compare performance on file systems like ext4, btrfs (the >default with Fedora 33) and xfs? > > For what my two cents are worth: while yes, the performance angle is I'd guess probably not real relevant these days in the face of widespread noatime/relatime mount options (though I haven't done any measurements), I can see the semantic angle -- but adding flags to individual tools seems like an awkward way to go about solving the problem. Something like an LD_PRELOAD hack to shove O_NOATIME into the flags argument of every open(2) call comes to mind... Zev