Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

The only perfect science is hind-sight.


devel / comp.unix.shell / Re: why is it OK for grep to find files?

SubjectAuthor
* why is it OK for grep to find files?Ed Morton
+* why is it OK for grep to find files?Richard Kettlewell
|+* why is it OK for grep to find files?Ed Morton
||`- why is it OK for grep to find files?Richard Kettlewell
|`- why is it OK for grep to find files?Ed Morton
+* why is it OK for grep to find files?Chris Elvidge
|+- why is it OK for grep to find files?Lew Pitcher
|`* why is it OK for grep to find files?Ed Morton
| `- why is it OK for grep to find files?Chris Elvidge
+* why is it OK for grep to find files?Kaz Kylheku
|+- why is it OK for grep to find files?Lew Pitcher
|`* why is it OK for grep to find files?Ed Morton
| +* why is it OK for grep to find files?John D Groenveld
| |`- why is it OK for grep to find files?Kaz Kylheku
| `* why is it OK for grep to find files?Richard Kettlewell
|  +* why is it OK for grep to find files?Kenny McCormack
|  |+* why is it OK for grep to find files?Janis Papanagnou
|  ||`* why is it OK for grep to find files?Damien Wyart
|  || `* why is it OK for grep to find files?Janis Papanagnou
|  ||  `* why is it OK for grep to find files?Damien Wyart
|  ||   `- why is it OK for grep to find files?Janis Papanagnou
|  |`* why is it OK for grep to find files?Richard Kettlewell
|  | `* why is it OK for grep to find files?Kenny McCormack
|  |  `- why is it OK for grep to find files?Janis Papanagnou
|  `* why is it OK for grep to find files?Ed Morton
|   +* why is it OK for grep to find files?Richard Kettlewell
|   |+* why is it OK for grep to find files?Ed Morton
|   ||+* why is it OK for grep to find files?Richard Kettlewell
|   |||+* why is it OK for grep to find files?Kenny McCormack
|   ||||`- why is it OK for grep to find files?hymie!
|   |||`* why is it OK for grep to find files?Ed Morton
|   ||| `* why is it OK for grep to find files?Richard Kettlewell
|   |||  `* why is it OK for grep to find files?Andy Walker
|   |||   `- why is it OK for grep to find files?Janis Papanagnou
|   ||`* why is it OK for grep to find files?Ben Bacarisse
|   || +* why is it OK for grep to find files?Ed Morton
|   || |`* why is it OK for grep to find files?Ben Bacarisse
|   || | +- why is it OK for grep to find files?Janis Papanagnou
|   || | +* why is it OK for grep to find files?Ed Morton
|   || | |`* why is it OK for grep to find files?Ben Bacarisse
|   || | | `* why is it OK for grep to find files?Ed Morton
|   || | |  `* why is it OK for grep to find files?Ben Bacarisse
|   || | |   `* why is it OK for grep to find files?Ed Morton
|   || | |    +* why is it OK for grep to find files?Janis Papanagnou
|   || | |    |`- why is it OK for grep to find files?Ed Morton
|   || | |    `* why is it OK for grep to find files?Ben Bacarisse
|   || | |     `* why is it OK for grep to find files?Ed Morton
|   || | |      +- why is it OK for grep to find files?Kaz Kylheku
|   || | |      `* why is it OK for grep to find files?Ben Bacarisse
|   || | |       `- why is it OK for grep to find files?Ed Morton
|   || | `- why is it OK for grep to find files?Ed Morton
|   || `* why is it OK for grep to find files?Geoff Clare
|   ||  `* why is it OK for grep to find files?Ben Bacarisse
|   ||   `* why is it OK for grep to find files?Keith Thompson
|   ||    +* why is it OK for grep to find files?Ben Bacarisse
|   ||    |`* why is it OK for grep to find files?Keith Thompson
|   ||    | `- why is it OK for grep to find files?Keith Thompson
|   ||    `- why is it OK for grep to find files?Kaz Kylheku
|   |`- why is it OK for grep to find files?Adam Funk
|   +* why is it OK for grep to find files?Kaz Kylheku
|   |+* why is it OK for grep to find files?Janis Papanagnou
|   ||`* why is it OK for grep to find files?Kaz Kylheku
|   || `- why is it OK for grep to find files?Janis Papanagnou
|   |+* why is it OK for grep to find files?Computer Nerd Kev
|   ||`* why is it OK for grep to find files?Javier
|   || `- why is it OK for grep to find files?Christian Weisgerber
|   |`* why is it OK for grep to find files?Ed Morton
|   | +- why is it OK for grep to find files?Kaz Kylheku
|   | `- why is it OK for grep to find files?Stan Moore
|   `* why is it OK for grep to find files?Janis Papanagnou
|    `- why is it OK for grep to find files?Ed Morton
+- why is it OK for grep to find files?Christian Weisgerber
`- why is it OK for grep to find files?Janis Papanagnou

Pages:123
Re: why is it OK for grep to find files?

<rak5vjxq5p.ln2@news.ducksburg.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7491&group=comp.unix.shell#7491

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: a24061@ducksburg.com (Adam Funk)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 06 Oct 2023 16:05:31 +0100
Organization: $CABAL
Lines: 44
Message-ID: <rak5vjxq5p.ln2@news.ducksburg.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 9y3ewA5YtysmtiVSKf3z7QjqMnFL4L0ag9BafrPd9C3lps6rcL
X-Orig-Path: news.ducksburg.com!not-for-mail
Cancel-Lock: sha1:XbNVrIOuqLCxIy5TKYU3eyMSGnk= sha1:QE0nhjCr2ifuJW00IWQBBq7SyPE= sha256:GYr7IfsRjAQY7e9ZyG1uElM3wL847/L3k1v6hYbeRZU=
User-Agent: slrn/pre1.0.4-6 (Linux)
 by: Adam Funk - Fri, 6 Oct 2023 15:05 UTC

On 2023-10-03, Richard Kettlewell wrote:

> Ed Morton <mortonspam@gmail.com> writes:
>> On 10/2/2023 2:09 AM, Richard Kettlewell wrote:
>>> Ed Morton <mortonspam@gmail.com> writes:
>>>> So I don't see any of that as justifying adding a bunch of options to
>>>> grep to do something other than it's primary purpose of g/re/p and
>>>> making it different from all other text processing tools in that
>>>> regard.
>>> Why do you think it needs justifying? It’s their code, they can add
>>> whatever they like to it.
>>
>> The GNU people added functionality to grep in a way that is
>> contradictory to the Unix philosophy and makes it inconsistent with
>> all other text processing tools.
>
> Why does that matter?
>
>> So far the only suggestion I've heard for why they did that is so
>> people could do:
>>
>> grep -r 'regexp'
>>
>> instead of:
>>
>> find . -type f -exec grep -H 'regexp' {} +
>>
>> which saves us about 20 simple, common characters over find+grep but
>> does nothing for find+awk, find+sed, etc.
>
> Sounds good to me. Less typing = better. Given the uptake of the GNU
> tools I suspect my opinion is widely shared.

I have to admit that I have been using grep -lr foo/ for so long that
it would never occur to me to try to wrangle find's arguments into
place for the purpose. The philosophical argument against grep -l is
understandable but for my own practical purposes I am grateful for it.

--
....the reason why so many professional artists drink a lot is not
necessarily very much to do with the artistic temperament, etc. It is
simply that they can afford to, because they can normally take a large
part of a day off to deal with the ravages. ---Amis _On Drink_

Re: why is it OK for grep to find files?

<ufp9p1$1k0r8$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7492&group=comp.unix.shell#7492

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 6 Oct 2023 17:40:16 +0200
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ufp9p1$1k0r8$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <wwv1qe93r39.fsf@LkoBDZeT.terraraq.uk>
<ufnd0p$15l30$1@dont-email.me> <wwv8r8gp6lo.fsf@LkoBDZeT.terraraq.uk>
<ufp4rr$1iint$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 6 Oct 2023 15:40:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c81969b83fc4e21e09c34682de6d2e7";
logging-data="1704808"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188e2Z++EUAjM7Tft4KjGub"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:S527YzmoL96g5aYLrRkHDrytzvE=
In-Reply-To: <ufp4rr$1iint$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 6 Oct 2023 15:40 UTC

On 06.10.2023 16:16, Andy Walker wrote:
>
> Well, that's the trouble with feeping creaturism. Once the
> creature has fept, it's impossible to reconsider it; there are always
> some people using it who mustn't be upset. The time to decide is
> /before/ adding it. [...]

Yes.

> [ disproportionally growing sizes of man-pages (since V7) ]

In our (post-V7, post-SysV) Linux era we now find also man pages
of smaller size - carrying only a hint to an info-page hierarchy.

Yes, it can get even worse.

Janis

Re: why is it OK for grep to find files?

<87ttr3vewk.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7493&group=comp.unix.shell#7493

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.gegeweb.eu!gegeweb.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 06 Oct 2023 10:28:43 -0700
Organization: None to speak of
Lines: 21
Message-ID: <87ttr3vewk.fsf@nosuchdomain.example.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<grc5vj-822.ln1@ID-313840.user.individual.net>
<8734ynam6i.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="b18bcd4706261467e0a233b8c97e52bc";
logging-data="1738644"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/a/aTCywpwzwTSJ/vk50zy"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:LNfPrEpnrOTtqgUHAEuTyahevvU=
sha1:49D6QkF8C0/l+f+7CIVO+zWoi/s=
 by: Keith Thompson - Fri, 6 Oct 2023 17:28 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:
>> Ben Bacarisse wrote:
>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>> that needs to be quoted (the {})
>>
>> The {} does not need to be quoted. That's because { is a reserved
>> word in the shell, not an operator like (.
>
> Is this true of all shells? I was going by the find man page. Maybe
> it needs an update?

`echo {}` prints "{}" in every shell I've tried (bash, csh, tcsh, ksh,
zsh, fish, dash, busybox sh).

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: why is it OK for grep to find files?

<87wmvz8pi6.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7494&group=comp.unix.shell#7494

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 06 Oct 2023 21:28:17 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <87wmvz8pi6.fsf@bsb.me.uk>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<grc5vj-822.ln1@ID-313840.user.individual.net>
<8734ynam6i.fsf@bsb.me.uk> <87ttr3vewk.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="4ad77f5a04acc3db17769a1a120a84b6";
logging-data="1995023"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lkLZ9VMZTvgZgYM6tvSig7QE9qEJa9Eg="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:V+V5blxMcLFQfXZW48siWtjutwk=
sha1:ynovz2ndq9W2W4aHMAAqfj0dJII=
X-BSB-Auth: 1.61cc92f24562b3973a1a.20231006212818BST.87wmvz8pi6.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 6 Oct 2023 20:28 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:
>>> Ben Bacarisse wrote:
>>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>>> that needs to be quoted (the {})
>>>
>>> The {} does not need to be quoted. That's because { is a reserved
>>> word in the shell, not an operator like (.
>>
>> Is this true of all shells? I was going by the find man page. Maybe
>> it needs an update?
>
> `echo {}` prints "{}" in every shell I've tried (bash, csh, tcsh, ksh,
> zsh, fish, dash, busybox sh).

The find man page repeats that {} "might" have to be escaped or quoted
several times. The EXAMPLES sections quotes it, and then some text goes
on to explain why!

I accept that it's wrong to say that.

So I'll change my remark back to the one I had intended: find uses
syntax that needs to be quoted (the ;). Annoyingly, I'd flipped from ;
to {} because I didn't think that ; was used in the quoted text!

--
Ben.

Re: why is it OK for grep to find files?

<87pm1rv3jt.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7495&group=comp.unix.shell#7495

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 06 Oct 2023 14:33:58 -0700
Organization: None to speak of
Lines: 37
Message-ID: <87pm1rv3jt.fsf@nosuchdomain.example.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<grc5vj-822.ln1@ID-313840.user.individual.net>
<8734ynam6i.fsf@bsb.me.uk> <87ttr3vewk.fsf@nosuchdomain.example.com>
<87wmvz8pi6.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="b18bcd4706261467e0a233b8c97e52bc";
logging-data="2020991"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19w7pFg6FJk8UGHpT+cwwJw"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:dcfgXadh5wihGx0mGcPMn3Qs0e4=
sha1:Y/JFnJh/zIJ5JQTlXShvMTgORKI=
 by: Keith Thompson - Fri, 6 Oct 2023 21:33 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:
>>>> Ben Bacarisse wrote:
>>>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>>>> that needs to be quoted (the {})
>>>>
>>>> The {} does not need to be quoted. That's because { is a reserved
>>>> word in the shell, not an operator like (.
>>>
>>> Is this true of all shells? I was going by the find man page. Maybe
>>> it needs an update?
>>
>> `echo {}` prints "{}" in every shell I've tried (bash, csh, tcsh, ksh,
>> zsh, fish, dash, busybox sh).
>
> The find man page repeats that {} "might" have to be escaped or quoted
> several times. The EXAMPLES sections quotes it, and then some text goes
> on to explain why!
>
> I accept that it's wrong to say that.
>
> So I'll change my remark back to the one I had intended: find uses
> syntax that needs to be quoted (the ;). Annoyingly, I'd flipped from ;
> to {} because I didn't think that ; was used in the quoted text!

The find(1) man page (for GNU findutils 4.8.0 and in the latest version
in the git repo) says in one place (under "-exec command ;") that {} and ;
*might* need to be escaped, and in another (under "-exec command {}+")
that {} *needs* to be escaped.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: why is it OK for grep to find files?

<20231006163444.307@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7496&group=comp.unix.shell#7496

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 6 Oct 2023 23:35:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <20231006163444.307@kylheku.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<grc5vj-822.ln1@ID-313840.user.individual.net> <8734ynam6i.fsf@bsb.me.uk>
<87ttr3vewk.fsf@nosuchdomain.example.com>
<op.2cer85h2a3w0dxdave@hodgins.homeip.net>
Injection-Date: Fri, 6 Oct 2023 23:35:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9f7061d1697a6b0d53d7b6e9ebc1e258";
logging-data="2064269"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RPYzkZf9dmzX64SdTwTnrrZxLHd5V9T8="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:2QuKM8FAk2FXqfPbJ2/9098WPvg=
 by: Kaz Kylheku - Fri, 6 Oct 2023 23:35 UTC

On 2023-10-06, David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
> On Fri, 06 Oct 2023 13:28:43 -0400, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> `echo {}` prints "{}" in every shell I've tried (bash, csh, tcsh, ksh,
>> zsh, fish, dash, busybox sh).
>
> From "man bash" ...
> { and } are reserved words and must occur where a reserved word is permitted to be recognized.
>
> So if they occur somewhere where a reserved word is not permitted, then they are
> just normal characters.

Same as:

echo while

etc. while is a reserved word but not everywhere.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: why is it OK for grep to find files?

<ufract$2af8o$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7497&group=comp.unix.shell#7497

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 7 Oct 2023 05:03:07 -0500
Organization: A noiseless patient Spider
Lines: 148
Message-ID: <ufract$2af8o$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 7 Oct 2023 10:03:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fd7f74de3acf12710204b5a03bb6788c";
logging-data="2440472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JwOArYHAMna9IGn7JRZE6"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UBdADalRqEQOOG7JxJo+wIyBdIM=
X-Antivirus: Avast (VPS 231007-0, 10/6/2023), Outbound message
Content-Language: en-US
X-Antivirus-Status: Clean
In-Reply-To: <878r8ga3mp.fsf@bsb.me.uk>
 by: Ed Morton - Sat, 7 Oct 2023 10:03 UTC

On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
> Ed Morton <mortonspam@gmail.com> writes:
>
>> On 10/5/2023 2:37 PM, Ben Bacarisse wrote:
>>> Ed Morton <mortonspam@gmail.com> writes:
>>>
>>>> On 10/3/2023 2:00 AM, Richard Kettlewell wrote:
>>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>>> On 10/2/2023 2:09 AM, Richard Kettlewell wrote:
>>>>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>>>>> So I don't see any of that as justifying adding a bunch of options to
>>>>>>>> grep to do something other than it's primary purpose of g/re/p and
>>>>>>>> making it different from all other text processing tools in that
>>>>>>>> regard.
>>>>>>> Why do you think it needs justifying? It’s their code, they can add
>>>>>>> whatever they like to it.
>>>>>>
>>>>>> The GNU people added functionality to grep in a way that is
>>>>>> contradictory to the Unix philosophy and makes it inconsistent with
>>>>>> all other text processing tools.
>>>>> Why does that matter?
>>>>
>>>> For the same reasons that cohesion and consistency matter in any
>>>> system. Google "software" with those 2 terms to find more information on
>>>> how those concepts apply to software.
>>> Those are not the only concepts that matter.
>>
>> Of course, they're just the answer to the question Richard asked.
>
> They are /your/ answer to his question -- these are the concepts that
> make it matter to you. Other concepts (like ease of use) don't
> necessarily give the same answer which is why I mention them.

I said "The GNU people added functionality to grep in a way that is
contradictory to the Unix philosophy and makes it inconsistent with all
other text processing tools." and in response Richard asked "Why does
that matter?"

I don't see how "ease of use" is an answer to Richard's question.

/My/
> answer would be "It doesn't matter much -- ease of use is too important
> in this case".

I'm claiming that X matters and being asked why, so responding that it
doesn't matter wouldn't make sense or be useful.

>
> (I hope you are not being hyper literal here. My "answer" is not an
> answer in the literal sense. If I took "Why does that matter?"
> absolutely literally, I'd have to give your answer as well with maybe
> just "but only a teeny, tiny bit" added. But ripostes like "Why does
> that matter?" are almost always rhetorical, and not literal requests for
> the reasons, no matter how insignificant the respondent might consider
> them to be.)
>
>>>> If Unix were being invented today and the design decision being presented
>>>> in an attempt to answer the question "how do we call a text processing tool
>>>> on every file found under a directory?" was:
>>>>
>>>> IF (tool == grep) && (provider == GNU) THEN
>>>> tool -r '...'
>>>> ELSE
>>>> find . -type f tool '...' {} +
>>>> ENDIF
>>>>
>>>> instead of just:
>>>>
>>>> find . -type f tool '...' {} +
>>> find . -type f -exec tool '...' '{}' +
>>
>> Right, thanks. I typed my response once and my newsreader discarded it so I
>> had to type it again and rushed it.
>>
>>>> the person suggesting it would be ridiculed and sent back to the drawing
>>>> board.
>>> It's not "just" find ... find is a mess. If the file system, the shell
>>> and all the rest were such that adding some command or prefix like
>>> rec grep pattern .
>>> made grep behave pretty much like grep -r then no one would bother to
>>> add options like -r to grep.
>>
>> Agreed, that is the right solution if people are unhappy with `find` and
>> apparently there is an existing tool to do just that, see Janis's posts in
>> this thread.
>
> tw may be better than find, but that's a low bar. My "rec" was intended
> to be hypothetical. I should maybe have said that if it were possible
> to have a rec prefix that magically just "did the right thing" then -r
> would not be needed.
>
> But your remark raises an interesting question. Are you happy with
> find? I use it quite a lot, but I am unhappy with it pretty much every
> time!
>
>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>> that needs to be quoted (the {}) and does not always preserve the desred
>>> behaviour. For example
>>> grep -rq needle haystack
>>> can succeed (exit 0) where
>>> find haystack -type f -exec grep -q needle '{}' +
>>> can fail (exit non-zero). This is because find can run multiple
>>> commands and does not always combine the exit statuses correctly. I
>>> would be happy to be wrong about this, but I'm sure I tested it some
>>> time ago.
>>
>> Interesting - that's not something I've ever come across but thanks for
>> bringing it up as a possible concern.
>
> It's not a possible concern, it's an actual concern!

It's only an actual concern if it actually happens and you're saying
above that you're not sure if it happens or not, it's just something you
think you saw some time in the past ("I would be happy to be wrong about
this, but I'm sure I tested it some time ago."), hence my saying it's a
possible concern.

If you want to
> know if "pattern" occurs in any file from . down, you /can't/ use
>
> find . -type f -exec grep -q pattern '{}' +
>
> because you will get the wrong answer in some cases.

OK, then don't do that, do it one of the various other simple ways it
can be done, e.g.:

find . -type f -exec grep -m1 pattern '{}' +

and test for any output, but I'm not arguing that `find` is the best
possible answer to the issues, I'm saying that adding `-r` to grep is
the wrong answer for the reasons I've already stated.

>
> But consider the general case... Imagine a collection of tools to test
> if a file has this or that property. The tools can all have multiple
> arguments but what do they do with conflicting answers? For some
> properties it might be useful for the tool to report success (0) if
> /all/ the arguments have that property and for other properties it might
> be desirable to report success if /any/ of the arguments have it. If
> find splits an argument list into two and the tool reports 0 on one half
> and 1 on the second, what should find report? If the tool is an "all"
> tool it should report 1, and if the tool is an "any" tool it should
> report 0.

How does adding "-r" to grep solve that problem for awk and sed?

Ed.

Re: why is it OK for grep to find files?

<ufrba3$2al98$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7498&group=comp.unix.shell#7498

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 7 Oct 2023 05:18:43 -0500
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <ufrba3$2al98$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 7 Oct 2023 10:18:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fd7f74de3acf12710204b5a03bb6788c";
logging-data="2446632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0kk393e1i2sFKHqvoRvGB"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XgNIHyfGkIbcN4du2oi0onLsOTs=
X-Antivirus-Status: Clean
X-Antivirus: Avast (VPS 231007-0, 10/6/2023), Outbound message
In-Reply-To: <878r8ga3mp.fsf@bsb.me.uk>
Content-Language: en-US
 by: Ed Morton - Sat, 7 Oct 2023 10:18 UTC

On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
<snip>

I forgot to answer your question below in my preceding post, sorry:

> But your remark raises an interesting question. Are you happy with
> find? I use it quite a lot, but I am unhappy with it pretty much every
> time!

I find it's arguments clunky and arcane and, after 40+ years of using
it, any time I want to do more than `find . -type f \( -name X -o name Y
\) -exec foo {} +` I still have to look up the man page BUT I rarely
have to do more than that with it so that doesn't overly bother me.

That doesn't mean that giving grep (and only grep among all the text
processing tools) the ability to find files was the best possible
solution to that problem, if it needs to be solved.

Ed.

Re: why is it OK for grep to find files?

<ufrcd4$2al98$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7499&group=comp.unix.shell#7499

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 7 Oct 2023 05:37:24 -0500
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <ufrcd4$2al98$2@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <20231003001305.667@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 7 Oct 2023 10:37:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fd7f74de3acf12710204b5a03bb6788c";
logging-data="2446632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0e7Q20UYrJT5/P22EN8jT"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KKyPRtlBGGpJvoc5cCXrIdeel0I=
X-Antivirus: Avast (VPS 231007-0, 10/6/2023), Outbound message
X-Antivirus-Status: Clean
Content-Language: en-US
In-Reply-To: <20231003001305.667@kylheku.com>
 by: Ed Morton - Sat, 7 Oct 2023 10:37 UTC

On 10/3/2023 2:26 AM, Kaz Kylheku wrote:
> On 2023-10-02, Ed Morton <mortonspam@gmail.com> wrote:
>> On 10/2/2023 2:09 AM, Richard Kettlewell wrote:
>>> Ed Morton <mortonspam@gmail.com> writes:
>>>> So I don't see any of that as justifying adding a bunch of options to
>>>> grep to do something other than it's primary purpose of g/re/p and
>>>> making it different from all other text processing tools in that
>>>> regard.
>>>
>>> Why do you think it needs justifying? It’s their code, they can add
>>> whatever they like to it.
>>>
>>
>> The GNU people added functionality to grep in a way that is
>> contradictory to the Unix philosophy and makes it inconsistent with all
>> other text processing tools.
>
> - GNU stands for GNU is Not Unix.
>
> - The GNU coding standards document says:
>
> The GNU Project regards standards published by other organizations
> as suggestions, not orders. We consider those standards, but we do
> not “obey” them. In developing a GNU program, you should implement
> an outside standard’s specifications when that makes the GNU system
> better overall in an objective sense. When it doesn’t, you shouldn’t.

To be clear, I'm not talking about "grep -r" violating any standards,
I'm talking about it violating the Unix philosophy and software
engineering fundamentals of cohesion and consistency.

>
> - Unix programs have recursion built in: from memory I can think of
> ls, rm, cp, mv, chgrp, chmod and chown.

Those all operate on file attributes, not on the contents of files as
text processing tools like grep do. Tools like `rm` or `chmod` being
able to find and perform actions on files is equivalent to text
processing tools like `grep` or `awk` being able to find and perform
actions on text inside files.

>
> - BSD Unixes have a -R option on grep; some, like FreeBSD, have an -r
> option as well as a rgrep utility.

Yes, GNUisms are apparently creeping into BSD tools, usually for the
better though.

Ed.

Re: why is it OK for grep to find files?

<20231007080835.956@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7500&group=comp.unix.shell#7500

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 7 Oct 2023 15:09:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <20231007080835.956@kylheku.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <20231003001305.667@kylheku.com>
<ufrcd4$2al98$2@dont-email.me>
Injection-Date: Sat, 7 Oct 2023 15:09:26 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9f7061d1697a6b0d53d7b6e9ebc1e258";
logging-data="2570617"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KaNIwXPM76dzz+AMsLs7SOUQIE6ViO7E="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:wl+Yv5o/z2wcyUpDSxHdVf6rkBE=
 by: Kaz Kylheku - Sat, 7 Oct 2023 15:09 UTC

On 2023-10-07, Ed Morton <mortonspam@gmail.com> wrote:
> To be clear, I'm not talking about "grep -r" violating any standards,
> I'm talking about it violating the Unix philosophy and software
> engineering fundamentals of cohesion and consistency.

Unix doesn't withstand a moment's scrutiny in the light of any of
these lofty words.

Re: why is it OK for grep to find files?

<87lece84bz.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7501&group=comp.unix.shell#7501

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 07 Oct 2023 23:17:52 +0100
Organization: A noiseless patient Spider
Lines: 133
Message-ID: <87lece84bz.fsf@bsb.me.uk>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="b80d8873568d9e06111403cd7c67c346";
logging-data="2778164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FUxS5VQ+aEPlTVoFXzNFOEVnBfz16Lzw="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:0uNmb2EYCA2Jol5uUJtv+kMr5o4=
sha1:Alc7VOsKn7d3RArR2xfgb534NX4=
X-BSB-Auth: 1.057cfb4d978e4a5d567e.20231007231752BST.87lece84bz.fsf@bsb.me.uk
 by: Ben Bacarisse - Sat, 7 Oct 2023 22:17 UTC

Ed Morton <mortonspam@gmail.com> writes:

> On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
>> Ed Morton <mortonspam@gmail.com> writes:
>>
>>> On 10/5/2023 2:37 PM, Ben Bacarisse wrote:
>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>
>>>>> On 10/3/2023 2:00 AM, Richard Kettlewell wrote:
>>>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>>>> On 10/2/2023 2:09 AM, Richard Kettlewell wrote:
>>>>>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>>>>>> So I don't see any of that as justifying adding a bunch of options to
>>>>>>>>> grep to do something other than it's primary purpose of g/re/p and
>>>>>>>>> making it different from all other text processing tools in that
>>>>>>>>> regard.
>>>>>>>> Why do you think it needs justifying? It’s their code, they can add
>>>>>>>> whatever they like to it.
>>>>>>>
>>>>>>> The GNU people added functionality to grep in a way that is
>>>>>>> contradictory to the Unix philosophy and makes it inconsistent with
>>>>>>> all other text processing tools.
>>>>>> Why does that matter?
>>>>>
>>>>> For the same reasons that cohesion and consistency matter in any
>>>>> system. Google "software" with those 2 terms to find more information on
>>>>> how those concepts apply to software.
>>>> Those are not the only concepts that matter.
>>>
>>> Of course, they're just the answer to the question Richard asked.
>> They are /your/ answer to his question -- these are the concepts that
>> make it matter to you. Other concepts (like ease of use) don't
>> necessarily give the same answer which is why I mention them.
>
> I said "The GNU people added functionality to grep in a way that is
> contradictory to the Unix philosophy and makes it inconsistent with all
> other text processing tools." and in response Richard asked "Why does that
> matter?"
>
> I don't see how "ease of use" is an answer to Richard's question.
>
>> /My/
>> answer would be "It doesn't matter much -- ease of use is too important
>> in this case".
>
> I'm claiming that X matters and being asked why, so responding that it
> doesn't matter wouldn't make sense or be useful.

Yes, I know. I thought that reading was "hyper literal" as explained
here:

>> (I hope you are not being hyper literal here. My "answer" is not an
>> answer in the literal sense. If I took "Why does that matter?"
>> absolutely literally, I'd have to give your answer as well with maybe
>> just "but only a teeny, tiny bit" added. But ripostes like "Why does
>> that matter?" are almost always rhetorical, and not literal requests for
>> the reasons, no matter how insignificant the respondent might consider
>> them to be.)

I think Richard's question was largely rhetorical. But maybe I'm
wrong. Maybe he did not know what inconsistency matters, and he's
learned from your reply.

>>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>>> that needs to be quoted (the {}) and does not always preserve the desred
>>>> behaviour. For example
>>>> grep -rq needle haystack
>>>> can succeed (exit 0) where
>>>> find haystack -type f -exec grep -q needle '{}' +
>>>> can fail (exit non-zero). This is because find can run multiple
>>>> commands and does not always combine the exit statuses correctly. I
>>>> would be happy to be wrong about this, but I'm sure I tested it some
>>>> time ago.
>>>
>>> Interesting - that's not something I've ever come across but thanks for
>>> bringing it up as a possible concern.
>> It's not a possible concern, it's an actual concern!
>
> It's only an actual concern if it actually happens and you're saying above
> that you're not sure if it happens or not, it's just something you think
> you saw some time in the past ("I would be happy to be wrong about this,
> but I'm sure I tested it some time ago."), hence my saying it's a possible
> concern.

Sure, but I went on to explain that it can't get it right in all cases
even if it happened to get this case right. "It" (relying on find to
combine exit statuses) really is an actual concern.

>> If you want to
>> know if "pattern" occurs in any file from . down, you /can't/ use
>> find . -type f -exec grep -q pattern '{}' +
>> because you will get the wrong answer in some cases.
>
> OK, then don't do that, do it one of the various other simple ways it can
> be done, e.g.:
>
> find . -type f -exec grep -m1 pattern '{}' +
>
> and test for any output, but I'm not arguing that `find` is the best
> possible answer to the issues, I'm saying that adding `-r` to grep is the
> wrong answer for the reasons I've already stated.

Yes, we all know how to do it other ways (and I like grep -r as the way
to do it). My point was that you exaggerated the simplicity of just
using find as an alternative. The consistent solution (no tool to
provide a -r option because that's a job for find) imposes a significant
cognitive load: remember change the command when you want to rely on the
(possibly)combined exit status.

The first time I encountered this problem was in a script that just
stopped working one day. The set of files had got large enough that
find has split them into two executions of grep. Now you can argue that
I should have been more careful. It's obvious (once you think about it)
that find can't get the right answer in all cases, but it's still part
of what makes find complicated.

>> But consider the general case... Imagine a collection of tools to test
>> if a file has this or that property. The tools can all have multiple
>> arguments but what do they do with conflicting answers? For some
>> properties it might be useful for the tool to report success (0) if
>> /all/ the arguments have that property and for other properties it might
>> be desirable to report success if /any/ of the arguments have it. If
>> find splits an argument list into two and the tool reports 0 on one half
>> and 1 on the second, what should find report? If the tool is an "all"
>> tool it should report 1, and if the tool is an "any" tool it should
>> report 0.
>
> How does adding "-r" to grep solve that problem for awk and sed?

Eh?

--
Ben.

Re: why is it OK for grep to find files?

<uftc63$2th7n$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7502&group=comp.unix.shell#7502

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 7 Oct 2023 23:45:56 -0500
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <uftc63$2th7n$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 8 Oct 2023 04:45:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9102387aeb66999c61397ebfc0b4b0bb";
logging-data="3065079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188TeleP5swFIurlHK4Xnpu"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:S8CefFCcoN1BRzJQU2V4p6jCiSE=
In-Reply-To: <87lece84bz.fsf@bsb.me.uk>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 231007-4, 10/7/2023), Outbound message
 by: Ed Morton - Sun, 8 Oct 2023 04:45 UTC

On 10/7/2023 5:17 PM, Ben Bacarisse wrote:
> Ed Morton <mortonspam@gmail.com> writes:
>
>> On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
<snip>
>>> But consider the general case... Imagine a collection of tools to test
>>> if a file has this or that property. The tools can all have multiple
>>> arguments but what do they do with conflicting answers? For some
>>> properties it might be useful for the tool to report success (0) if
>>> /all/ the arguments have that property and for other properties it might
>>> be desirable to report success if /any/ of the arguments have it. If
>>> find splits an argument list into two and the tool reports 0 on one half
>>> and 1 on the second, what should find report? If the tool is an "all"
>>> tool it should report 1, and if the tool is an "any" tool it should
>>> report 0.
>>
>> How does adding "-r" to grep solve that problem for awk and sed?
>
> Eh?
>

The problem you describe above isn't unique to grep, it also exists for
sed, awk and other tools. Giving GNU grep a "-r" option to solve the
problem for grep does nothing to solve the problem for any other tool,
but there are alternative solutions that could be implemented to solve
it for all similar tools as discussed elsethread.

Ed.

Re: why is it OK for grep to find files?

<878r8d8c2g.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7503&group=comp.unix.shell#7503

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sun, 08 Oct 2023 14:43:03 +0100
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <878r8d8c2g.fsf@bsb.me.uk>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="b80d8873568d9e06111403cd7c67c346";
logging-data="3292192"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4V1CP6gJ4JlV0XUBVEjop2H7vP6xhxTU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:U26lSLh8AkdAngnzTfxEUq/cCFw=
sha1:1yxV4PPYGeX55CS4BKvQsEoEAeA=
X-BSB-Auth: 1.990b52442abac8fc44d9.20231008144303BST.878r8d8c2g.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 8 Oct 2023 13:43 UTC

Ed Morton <mortonspam@gmail.com> writes:

> On 10/7/2023 5:17 PM, Ben Bacarisse wrote:
>> Ed Morton <mortonspam@gmail.com> writes:
>>
>>> On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
> <snip>
>>>> But consider the general case... Imagine a collection of tools to test
>>>> if a file has this or that property. The tools can all have multiple
>>>> arguments but what do they do with conflicting answers? For some
>>>> properties it might be useful for the tool to report success (0) if
>>>> /all/ the arguments have that property and for other properties it might
>>>> be desirable to report success if /any/ of the arguments have it. If
>>>> find splits an argument list into two and the tool reports 0 on one half
>>>> and 1 on the second, what should find report? If the tool is an "all"
>>>> tool it should report 1, and if the tool is an "any" tool it should
>>>> report 0.
>>>
>>> How does adding "-r" to grep solve that problem for awk and sed?
>> Eh?
>>
>
> The problem you describe above isn't unique to grep, it also exists for
> sed, awk and other tools.

Yes. The problem is even described in a tool-agnostic way -- no mention
of grep at all!

> Giving GNU grep a "-r" option to solve the
> problem for grep does nothing to solve the problem for any other tool, but
> there are alternative solutions that could be implemented to solve it for
> all similar tools as discussed elsethread.

Two points. I don't thing there are alternative solutions, but if so,
can you point me to them as I've lost track? I want to find one (since
I've been bitten by this problem) so I would like to check them out.

Secondly, I am pretty sure that any near solution to this problem will
come with complications. Your original complaint was based on adding -r
to grep (a very common use case) when find is the consistent option.
But find's behaviour is /not/ consistent with what grep does as I have
detailed above. I would go so far as to argue that a solution that is
apparently coherent and consistent, right up until it breaks because of
something arbitrary like when find breaks it's argument list is
borderline dangerous. At the very least, it requires more careful
thought than remembering which tools have -r.

A good, consistent, solution would be allow an argument list to be
supplied by a generator. The program could get to work as soon as it
had a file to process, but there would be no limit on the number of
files. But this is not possible with the Unix model of what constitutes
a command's arguments.

--
Ben.

Re: why is it OK for grep to find files?

<ug0ujn$3tg8b$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7504&group=comp.unix.shell#7504

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Mon, 9 Oct 2023 08:18:47 -0500
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <ug0ujn$3tg8b$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 9 Oct 2023 13:18:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d5ec0972206be1b3762da7c95c7776d9";
logging-data="4112651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JMp0BC3VLRQXPs+tcA3Pr"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:c3J/iLK1aym5cM6DX6zx5rBIdCs=
In-Reply-To: <878r8d8c2g.fsf@bsb.me.uk>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 231008-2, 10/8/2023), Outbound message
 by: Ed Morton - Mon, 9 Oct 2023 13:18 UTC

On 10/8/2023 8:43 AM, Ben Bacarisse wrote:
> Ed Morton <mortonspam@gmail.com> writes:
>
>> On 10/7/2023 5:17 PM, Ben Bacarisse wrote:
>>> Ed Morton <mortonspam@gmail.com> writes:
>>>
>>>> On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
>> <snip>
>>>>> But consider the general case... Imagine a collection of tools to test
>>>>> if a file has this or that property. The tools can all have multiple
>>>>> arguments but what do they do with conflicting answers? For some
>>>>> properties it might be useful for the tool to report success (0) if
>>>>> /all/ the arguments have that property and for other properties it might
>>>>> be desirable to report success if /any/ of the arguments have it. If
>>>>> find splits an argument list into two and the tool reports 0 on one half
>>>>> and 1 on the second, what should find report? If the tool is an "all"
>>>>> tool it should report 1, and if the tool is an "any" tool it should
>>>>> report 0.
>>>>
>>>> How does adding "-r" to grep solve that problem for awk and sed?
>>> Eh?
>>>
>>
>> The problem you describe above isn't unique to grep, it also exists for
>> sed, awk and other tools.
>
> Yes. The problem is even described in a tool-agnostic way -- no mention
> of grep at all!
>
>> Giving GNU grep a "-r" option to solve the
>> problem for grep does nothing to solve the problem for any other tool, but
>> there are alternative solutions that could be implemented to solve it for
>> all similar tools as discussed elsethread.
>
> Two points. I don't thing there are alternative solutions, but if so,
> can you point me to them as I've lost track? I want to find one (since
> I've been bitten by this problem) so I would like to check them out.

A tool such as the tree-walk "tw"
(https://github.com/att/ast/tree/master/src/cmd/tw) tool that apparently
can find files and call a tool on those found files as suggested by me
and others in this thread. I'm not saying that THAT tool is the
solution, though, (I'd never heard of it till it was mentioned in this
thread and I don't know any more about it) I'm saying a solution for all
tools could have been created instead of modifying grep as was done.

>
> Secondly, I am pretty sure that any near solution to this problem will
> come with complications. Your original complaint was based on adding -r
> to grep (a very common use case) when find is the consistent option.

My complaint is that adding -r to grep makes it inconsistent with and
doesn't solve the issues for any of the other similar tools.

> But find's behaviour is /not/ consistent with what grep does as I have
> detailed above. I would go so far as to argue that a solution that is
> apparently coherent and consistent, right up until it breaks because of
> something arbitrary like when find breaks it's argument list is
> borderline dangerous. At the very least, it requires more careful
> thought than remembering which tools have -r.

I'm not saying that "find" solves all of the issues, I'm saying that
adding "-r" to grep was the wrong thing to do as it doesn't solve all
the issues and introduces other issues.

Ed.

> A good, consistent, solution would be allow an argument list to be
> supplied by a generator. The program could get to work as soon as it
> had a file to process, but there would be no limit on the number of
> files. But this is not possible with the Unix model of what constitutes
> a command's arguments.
>

Re: why is it OK for grep to find files?

<ug13vh$3v8ro$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7505&group=comp.unix.shell#7505

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Mon, 9 Oct 2023 16:50:24 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <ug13vh$3v8ro$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 9 Oct 2023 14:50:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c4d6ac75373dcbc46699780b4bcad363";
logging-data="4170616"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6aci0JUDQWKZ/0oOUl5Mu"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:5zFwedwgXOLwOrHms2yNQABEozs=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <ug0ujn$3tg8b$1@dont-email.me>
 by: Janis Papanagnou - Mon, 9 Oct 2023 14:50 UTC

On 09.10.2023 15:18, Ed Morton wrote:
> On 10/8/2023 8:43 AM, Ben Bacarisse wrote:
>>
>> Secondly, I am pretty sure that any near solution to this problem will
>> come with complications. Your original complaint was based on adding -r
>> to grep (a very common use case) when find is the consistent option.
>
> My complaint is that adding -r to grep makes it inconsistent with and
> doesn't solve the issues for any of the other similar tools.

I think there's even a bigger issue. It's usually not sufficient to add
only a -r option, more sooner than later you want to control subsets of
the directory tree, thus have to add yet more options - to *every* tool
that is to be enhanced by a [built-in] recursive tree-walk function.
And every tool will choose its own option subset (and usually also its
own syntax) to implement that.

This observation (incl. inconsistencies between tools' implementations)
make it (design-wise) straightforward for a separation (as already
posted) like tw -tw-options... cmd -cmd-options... cmd-args...

Looking into the original post's GNU grep's options example is quite
enlightening, I'd say.

Janis

Re: why is it OK for grep to find files?

<ug1fvb$22ae$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7506&group=comp.unix.shell#7506

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Mon, 9 Oct 2023 13:15:07 -0500
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <ug1fvb$22ae$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me> <ug13vh$3v8ro$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 9 Oct 2023 18:15:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="956db29fcf411611e9de2624baf297ef";
logging-data="67918"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+y8Q9qvvl8Up20GJwLx2/E"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PS7LjkYaS9T6yzYbISCsVLaSh3A=
In-Reply-To: <ug13vh$3v8ro$1@dont-email.me>
Content-Language: en-US
X-Antivirus-Status: Clean
X-Antivirus: Avast (VPS 231009-6, 10/9/2023), Outbound message
 by: Ed Morton - Mon, 9 Oct 2023 18:15 UTC

On 10/9/2023 9:50 AM, Janis Papanagnou wrote:
> On 09.10.2023 15:18, Ed Morton wrote:
>> On 10/8/2023 8:43 AM, Ben Bacarisse wrote:
>>>
>>> Secondly, I am pretty sure that any near solution to this problem will
>>> come with complications. Your original complaint was based on adding -r
>>> to grep (a very common use case) when find is the consistent option.
>>
>> My complaint is that adding -r to grep makes it inconsistent with and
>> doesn't solve the issues for any of the other similar tools.
>
> I think there's even a bigger issue. It's usually not sufficient to add
> only a -r option,

Right, I'm just using the phrase "adding -r" as an abbreviation for
"adding a bunch of options to find files".

> more sooner than later you want to control subsets of
> the directory tree, thus have to add yet more options - to *every* tool
> that is to be enhanced by a [built-in] recursive tree-walk function.
> And every tool will choose its own option subset (and usually also its
> own syntax) to implement that.
>
> This observation (incl. inconsistencies between tools' implementations)
> make it (design-wise) straightforward for a separation (as already
> posted) like tw -tw-options... cmd -cmd-options... cmd-args...
>
> Looking into the original post's GNU grep's options example is quite
> enlightening, I'd say.

Right again. Adding those options to 1 of the text processing tools was
absurd and adding them to every similar tool would also be absurd -
there is no good solution down that path.

Ed.
>
> Janis
>

Re: why is it OK for grep to find files?

<87edi37g9i.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7507&group=comp.unix.shell#7507

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Mon, 09 Oct 2023 20:22:17 +0100
Organization: A noiseless patient Spider
Lines: 104
Message-ID: <87edi37g9i.fsf@bsb.me.uk>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="39501676898f3c17ed4e55effbe9740e";
logging-data="101050"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fJlrwy/y8bd79MSEP643bGFcx7dLCEqU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:kllSqR25JEQQHYFrc1Uvso3xdV4=
sha1:QqtN0e/IqbKTuJvIwkCRvabw2X0=
X-BSB-Auth: 1.415bafc36123dce70fe1.20231009202217BST.87edi37g9i.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 9 Oct 2023 19:22 UTC

Ed Morton <mortonspam@gmail.com> writes:

> On 10/8/2023 8:43 AM, Ben Bacarisse wrote:
>> Ed Morton <mortonspam@gmail.com> writes:
>>
>>> On 10/7/2023 5:17 PM, Ben Bacarisse wrote:
>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>
>>>>> On 10/5/2023 9:25 PM, Ben Bacarisse wrote:
>>> <snip>
>>>>>> But consider the general case... Imagine a collection of tools to test
>>>>>> if a file has this or that property. The tools can all have multiple
>>>>>> arguments but what do they do with conflicting answers? For some
>>>>>> properties it might be useful for the tool to report success (0) if
>>>>>> /all/ the arguments have that property and for other properties it might
>>>>>> be desirable to report success if /any/ of the arguments have it. If
>>>>>> find splits an argument list into two and the tool reports 0 on one half
>>>>>> and 1 on the second, what should find report? If the tool is an "all"
>>>>>> tool it should report 1, and if the tool is an "any" tool it should
>>>>>> report 0.
>>>>>
>>>>> How does adding "-r" to grep solve that problem for awk and sed?
>>>> Eh?
>>>>
>>>
>>> The problem you describe above isn't unique to grep, it also exists for
>>> sed, awk and other tools.
>> Yes. The problem is even described in a tool-agnostic way -- no mention
>> of grep at all!
>>
>>> Giving GNU grep a "-r" option to solve the
>>> problem for grep does nothing to solve the problem for any other tool, but
>>> there are alternative solutions that could be implemented to solve it for
>>> all similar tools as discussed elsethread.
>> Two points. I don't thing there are alternative solutions, but if so,
>> can you point me to them as I've lost track? I want to find one (since
>> I've been bitten by this problem) so I would like to check them out.
>
> A tool such as the tree-walk "tw"
> (https://github.com/att/ast/tree/master/src/cmd/tw) tool that apparently
> can find files and call a tool on those found files as suggested by me and
> others in this thread. I'm not saying that THAT tool is the solution,

For the record, it does not even address the problem I outlined above,
much less solve it. The man page does not even say what its return
status is, so it can't be relied on to anything predictable.

> though, (I'd never heard of it till it was mentioned in this thread and I
> don't know any more about it) I'm saying a solution for all tools could
> have been created instead of modifying grep as was done.

Right. But until there is such a tool, it's hard to be definite about
the merits or demerits of grep -r. With a simple easy to use "rec"
tool, I would ditch using -r because a general solution is obviously
better. But, given the limitations of the Unix process model, it would
have to have flags to allow the user to choose how exit statuses are
combined. It's never going to be totally trivial so there will always
to a slight pressure to implement tool-specific solutions.

>> Secondly, I am pretty sure that any near solution to this problem will
>> come with complications. Your original complaint was based on adding -r
>> to grep (a very common use case) when find is the consistent option.
>
> My complaint is that adding -r to grep makes it inconsistent with and
> doesn't solve the issues for any of the other similar tools.

Yes, that's well understood and I am not disputing it.

Adding -R to ls introduced the same inconsistency a long time ago and
it's not alone. chown, chgrp, diff, rm and cp come to mind. Does the
fact that some of these need to operate in a specific order give them a
pass in your opinion? If so, why does grep -r not get the same pass
given that find -exec grep can't work for all of its uses cases either?

And if not (i.e. if you think none of these should have -r/-R options
either) why is your complaint not about find? Surely the problem would
then be that find it not up to the job, thus forcing the issue for some
tools.

>> But find's behaviour is /not/ consistent with what grep does as I have
>> detailed above. I would go so far as to argue that a solution that is
>> apparently coherent and consistent, right up until it breaks because of
>> something arbitrary like when find breaks it's argument list is
>> borderline dangerous. At the very least, it requires more careful
>> thought than remembering which tools have -r.
>
> I'm not saying that "find" solves all of the issues, I'm saying that adding
> "-r" to grep was the wrong thing to do as it doesn't solve all the issues
> and introduces other issues.

Yes, I get that that is your opinion. My opinion is that since find is
not up to the job, it's hard to say that grep -r was the wrong thing to
do. Do you think that ls -R, rm -r and chmod -r were the wrong thing to
do? What about cp -r? The syntax of find would have to be made even
more complex to make that one work.

I agree that a better solution, in some cases, would be a better find,
but given the limitations it has to work under, even then one would have
to weight up the pros and cons of tool-specific recursive options
because getting it right for grep, rm, chmod and so on is going to
involve more that just a simple "tree-walk" command.

--
Ben.

Re: why is it OK for grep to find files?

<ug3t90$17o5b$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7508&group=comp.unix.shell#7508

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Tue, 10 Oct 2023 11:14:26 -0500
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ug3t90$17o5b$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me> <87edi37g9i.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 10 Oct 2023 16:14:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c0f6638378680722519bccc6b27bfd6";
logging-data="1302699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+076Q9mlx9c9GmbhN/IvL1"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:VHHHOq60G36RbXTvicQAM675E5k=
Content-Language: en-US
X-Antivirus: Avast (VPS 231010-2, 10/10/2023), Outbound message
X-Antivirus-Status: Clean
In-Reply-To: <87edi37g9i.fsf@bsb.me.uk>
 by: Ed Morton - Tue, 10 Oct 2023 16:14 UTC

On 10/9/2023 2:22 PM, Ben Bacarisse wrote:
<snip>
> Do you think that ls -R, rm -r and chmod -r were the wrong thing to
> do? What about cp -r?

As I mentioned elsethread, those are tools that operate on file
attributes, not file contents, so it seems as reasonable to me for them
to be able to find files to operate on as it does for tools that operate
on file contents, such as grep and awk, to be able to find that text
within files to operate on.

If someone decided to add arguments to `rm` or `cp` to change the
contents of files then we could have this same discussion about breaking
with Unix philosophy, loose cohesion, etc. about those tools.

Ed.

Re: why is it OK for grep to find files?

<20231010115909.216@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7509&group=comp.unix.shell#7509

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Tue, 10 Oct 2023 19:01:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <20231010115909.216@kylheku.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me> <87edi37g9i.fsf@bsb.me.uk>
<ug3t90$17o5b$1@dont-email.me>
Injection-Date: Tue, 10 Oct 2023 19:01:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="68484e64d33315ab8239b10c382ff7da";
logging-data="1378475"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TULItBX7Tvkt/2DAWPPPRnTiOR93PMas="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:rqbsKx7zxKtfd5gd6CvaNuyScsc=
 by: Kaz Kylheku - Tue, 10 Oct 2023 19:01 UTC

On 2023-10-10, Ed Morton <mortonspam@gmail.com> wrote:
> On 10/9/2023 2:22 PM, Ben Bacarisse wrote:
><snip>
>> Do you think that ls -R, rm -r and chmod -r were the wrong thing to
>> do? What about cp -r?
>
> As I mentioned elsethread, those are tools that operate on file
> attributes, not file contents, so it seems as reasonable to me for them
> to be able to find files to operate on as it does for tools that operate
> on file contents, such as grep and awk, to be able to find that text
> within files to operate on.
>
> If someone decided to add arguments to `rm` or `cp` to change the
> contents of files then we could have this same discussion about breaking
> with Unix philosophy, loose cohesion, etc. about those tools.

They do change the contents of files.

One makes them disappear (if the link count drops to zero). The other
can change the content of a an existing file B to be the same as that
of existing file A:

cp A B

It is grep that doesn't change file contents, only reporting on them.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: why is it OK for grep to find files?

<87lec83d62.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7510&group=comp.unix.shell#7510

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Thu, 12 Oct 2023 01:19:33 +0100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <87lec83d62.fsf@bsb.me.uk>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me> <87edi37g9i.fsf@bsb.me.uk>
<ug3t90$17o5b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="625706da703fbb31625f3f3bd250e95a";
logging-data="2229458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oewJr9tNOYJtmi3qZpwKuSQ88XUJxboI="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:Tn8UYJsxK05sJh+WNirkQoG4zCo=
sha1:s8GqUE/eAVbxHkV+uHU4gBaqkW4=
X-BSB-Auth: 1.6943fc25b16d48c09413.20231012011933BST.87lec83d62.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 12 Oct 2023 00:19 UTC

Ed Morton <mortonspam@gmail.com> writes:

> On 10/9/2023 2:22 PM, Ben Bacarisse wrote:
> <snip>
>> Do you think that ls -R, rm -r and chmod -r were the wrong thing to
>> do? What about cp -r?
>
> As I mentioned elsethread, those are tools that operate on file attributes,
> not file contents, so it seems as reasonable to me for them to be able to
> find files to operate on as it does for tools that operate on file
> contents, such as grep and awk, to be able to find that text within files
> to operate on.

I was going to suggest that, as we have both made our points well enough
by now, we could call it a day, but you've introduced a whole new
mystery (to me at least) about what kinds of tool can get away with
having -r and which can't.

To my mind, if I were re-designing the way programs get their arguments,
I would want to come up with one solution that worked for as many of the
above as possible.

--
Ben.

Re: why is it OK for grep to find files?

<878r88tzsr.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7511&group=comp.unix.shell#7511

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Wed, 11 Oct 2023 18:06:12 -0700
Organization: None to speak of
Lines: 41
Message-ID: <878r88tzsr.fsf@nosuchdomain.example.com>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<grc5vj-822.ln1@ID-313840.user.individual.net>
<8734ynam6i.fsf@bsb.me.uk> <87ttr3vewk.fsf@nosuchdomain.example.com>
<87wmvz8pi6.fsf@bsb.me.uk> <87pm1rv3jt.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="0d09a1fd828b856f1a82ca58c0c8ac6b";
logging-data="2241159"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RB9u1LJJk+rPhWJu6ZKid"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:BlvIXmwgU1OoBeWGGnQUTTmuD4w=
sha1:SCHyGmvIpEfZjGoetcWvL7rvpAk=
 by: Keith Thompson - Thu, 12 Oct 2023 01:06 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>>> Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:
>>>>> Ben Bacarisse wrote:
>>>>>> But find is the best we have, and it's a mess. It uses mandatory syntax
>>>>>> that needs to be quoted (the {})
>>>>>
>>>>> The {} does not need to be quoted. That's because { is a reserved
>>>>> word in the shell, not an operator like (.
>>>>
>>>> Is this true of all shells? I was going by the find man page. Maybe
>>>> it needs an update?
>>>
>>> `echo {}` prints "{}" in every shell I've tried (bash, csh, tcsh, ksh,
>>> zsh, fish, dash, busybox sh).
>>
>> The find man page repeats that {} "might" have to be escaped or quoted
>> several times. The EXAMPLES sections quotes it, and then some text goes
>> on to explain why!
>>
>> I accept that it's wrong to say that.
>>
>> So I'll change my remark back to the one I had intended: find uses
>> syntax that needs to be quoted (the ;). Annoyingly, I'd flipped from ;
>> to {} because I didn't think that ; was used in the quoted text!
>
> The find(1) man page (for GNU findutils 4.8.0 and in the latest version
> in the git repo) says in one place (under "-exec command ;") that {} and ;
> *might* need to be escaped, and in another (under "-exec command {}+")
> that {} *needs* to be escaped.

I've submitted a bug report. No response so far.

https://lists.gnu.org/archive/html/bug-findutils/2023-10/msg00002.html

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: why is it OK for grep to find files?

<ugc3dp$3bnvi$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7512&group=comp.unix.shell#7512

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Fri, 13 Oct 2023 13:48:23 -0500
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <ugc3dp$3bnvi$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <wwv4jj8nqb1.fsf@LkoBDZeT.terraraq.uk>
<ufk8kq$e3hs$1@dont-email.me> <87edi8amj3.fsf@bsb.me.uk>
<ufnbr3$159j7$1@dont-email.me> <878r8ga3mp.fsf@bsb.me.uk>
<ufract$2af8o$1@dont-email.me> <87lece84bz.fsf@bsb.me.uk>
<uftc63$2th7n$1@dont-email.me> <878r8d8c2g.fsf@bsb.me.uk>
<ug0ujn$3tg8b$1@dont-email.me> <87edi37g9i.fsf@bsb.me.uk>
<ug3t90$17o5b$1@dont-email.me> <87lec83d62.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Oct 2023 18:48:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1796393877a317b5492d9e0d84079885";
logging-data="3530738"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18s/esiYelKugwe1BnHOxxi"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:r5CnD/ip41mIuhXGO4yIxcSYW6s=
X-Antivirus-Status: Clean
X-Antivirus: Avast (VPS 231012-2, 10/12/2023), Outbound message
In-Reply-To: <87lec83d62.fsf@bsb.me.uk>
Content-Language: en-US
 by: Ed Morton - Fri, 13 Oct 2023 18:48 UTC

On 10/11/2023 7:19 PM, Ben Bacarisse wrote:
> Ed Morton <mortonspam@gmail.com> writes:
>
>> On 10/9/2023 2:22 PM, Ben Bacarisse wrote:
>> <snip>
>>> Do you think that ls -R, rm -r and chmod -r were the wrong thing to
>>> do? What about cp -r?
>>
>> As I mentioned elsethread, those are tools that operate on file attributes,
>> not file contents, so it seems as reasonable to me for them to be able to
>> find files to operate on as it does for tools that operate on file
>> contents, such as grep and awk, to be able to find that text within files
>> to operate on.
>
> I was going to suggest that, as we have both made our points well enough
> by now, we could call it a day,

Me too but you asked me a question so I answered it.

> but you've introduced a whole new
> mystery (to me at least) about what kinds of tool can get away with
> having -r and which can't.
>
> To my mind, if I were re-designing the way programs get their arguments,
> I would want to come up with one solution that worked for as many of the
> above as possible.

Also me too but I'm not too bothered by tools that operate on file
properties (rm, mv, ls, etc.) having different ways to find files just
like I'm not too bothered by tools that operate on text file contents
(grep, sed, awk, etc.) having different ways to find the text within
those files.

Ed.

Re: why is it OK for grep to find files?

<ujsbso$2o7nk$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7544&group=comp.unix.shell#7544

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: stan@exis.net (Stan Moore)
Newsgroups: comp.unix.shell
Subject: Re: why is it OK for grep to find files?
Date: Sat, 25 Nov 2023 08:39:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <ujsbso$2o7nk$1@dont-email.me>
References: <ufblqv$1hpjc$1@dont-email.me> <20231001095145.664@kylheku.com>
<ufct99$2hrnj$1@dont-email.me> <wwvr0mda4am.fsf@LkoBDZeT.terraraq.uk>
<ufebb1$2ucbq$1@dont-email.me> <20231003001305.667@kylheku.com>
<ufrcd4$2al98$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 25 Nov 2023 08:39:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d6f774097106fc835a39dc8c67849dcd";
logging-data="2891508"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xf8/uQHFxxPrYqZGminPw"
User-Agent: slrn/1.0.3 (CYGWIN_NT-10.0)
Cancel-Lock: sha1:IMoIpvKUndwP//XQCn9cmttgi9E=
 by: Stan Moore - Sat, 25 Nov 2023 08:39 UTC

On 2023-10-07, Ed Morton <mortonspam@gmail.com> wrote:
> On 10/3/2023 2:26 AM, Kaz Kylheku wrote:
>> On 2023-10-02, Ed Morton <mortonspam@gmail.com> wrote:
>>> On 10/2/2023 2:09 AM, Richard Kettlewell wrote:
>>>> Ed Morton <mortonspam@gmail.com> writes:
>>>>> So I don't see any of that as justifying adding a bunch of options to
>>>>> grep to do something other than it's primary purpose of g/re/p and
>>>>> making it different from all other text processing tools in that
>>>>> regard.
>>>>
>>>> Why do you think it needs justifying? It’s their code, they can add
>>>> whatever they like to it.
>>>>
>>>
>>> The GNU people added functionality to grep in a way that is
>>> contradictory to the Unix philosophy and makes it inconsistent with all
>>> other text processing tools.
>>
>> - GNU stands for GNU is Not Unix.
>>
>> - The GNU coding standards document says:
>>
>> The GNU Project regards standards published by other organizations
>> as suggestions, not orders. We consider those standards, but we do
>> not “obey” them. In developing a GNU program, you should implement
>> an outside standard’s specifications when that makes the GNU system
>> better overall in an objective sense. When it doesn’t, you shouldn’t.
>
> To be clear, I'm not talking about "grep -r" violating any standards,
> I'm talking about it violating the Unix philosophy and software
> engineering fundamentals of cohesion and consistency.
>
>>
>> - Unix programs have recursion built in: from memory I can think of
>> ls, rm, cp, mv, chgrp, chmod and chown.
>
> Those all operate on file attributes, not on the contents of files as
> text processing tools like grep do. Tools like `rm` or `chmod` being
> able to find and perform actions on files is equivalent to text
> processing tools like `grep` or `awk` being able to find and perform
> actions on text inside files.
>
>>
>> - BSD Unixes have a -R option on grep; some, like FreeBSD, have an -r
>> option as well as a rgrep utility.
>
> Yes, GNUisms are apparently creeping into BSD tools, usually for the
> better though.
>
> Ed.
>

Couple of thoughts. First grep has been ported far and wide to systems
that bear little resemblance to unix/posix/linux. Some fraction of those
systems and users will not have access to find.

Second some of those same ported systems are not process friendly and
creating a process for find and another for grep might not be a reasonable
solution. I suspect these two things may have had some influence on
the current state.

Finally I find calling a modern day Ford Mustang a travesty since I'm old
enough to remember 1968. Similarly I find very little unix in todays systems
including the bsd's (geneology notwithstanding). Linux has never bought into
"the unix way" and any doubts were eliminated by systemd. GNU has never
made any real attempt to be limited the existing unix conventions or standards.
Considering the above saying gnu grep doesn't exactly act like a true
unix command is like saying "water is wet".

Personally I see grep -r as a gray area between inconsistent and probably
helpful to some users. I'm more concerned with the general quality of
the software I deal with every day to have bigger concerns about the
future of both software developers and users.

Grep may the the most widely know unix command outside of hardcore
unix types, and I don't expect you will get any traction with you
consisteny concerns. I would also be suprised if you get any
relief either. Don't let it keep you from having a happy holidays!

Stan

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor