bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Man page - mistaken instructions?


From: Jim Meyering
Subject: Re: Man page - mistaken instructions?
Date: Wed, 05 Jan 2011 10:43:01 +0100

Eric Blake wrote:
> On 01/04/2011 08:45 AM, Fernando Basso wrote:
>> I'm Fernando Basso from Brazil, and I run Arch Linux.
>>
>> $ grep --version
>> grep (GNU grep) 2.7
>>
>> man help says:
>>
>>     {,m}   The preceding item is matched at most m times.
>
> POSIX only requires:
>
> When a BRE matching a single character, a subexpression, or a
> back-reference is followed by an interval expression of the format
> "\{m\}", "\{m,\}", or "\{m,n\}", together
>
> so {,m} might be useful as shorthand for {0,m}, but is certainly not a
> required repetition form.  And given that it is currently rejected, you
> are correct that the documentation is buggy (or that we should add
> support for the shorthand as yet another GNU extension).

Thank you for the report.
I've fixed that with the patch below.

However, note that while grep does indeed reject \{,m\} as a BRE,
it does *not* reject {,m} as an ERE.  However, as an ERE, it does not
work as documented, either:

    $ echo aaa|grep -E 'a\{,3\}'
    [Exit 1]

I haven't tried to deduce what it is intended to do, if anything.


>From 01c082a8724de018d5f8876864043df757ea35a8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 5 Jan 2011 10:31:12 +0100
Subject: [PATCH] doc: remove erroneous "{,m}" item from grep man page

* doc/grep.in.1: Remove item describing bogus {,m} regex notation.
Reported by Fernando Basso.
---
 THANKS        |    1 +
 doc/grep.in.1 |    5 -----
 2 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/THANKS b/THANKS
index 57b4ea0..8c3d0d9 100644
--- a/THANKS
+++ b/THANKS
@@ -26,6 +26,7 @@ Dmitry V. Levin            <address@hidden>
 Egmont Koblinger           <address@hidden>
 Eli Zaretskii              <address@hidden>
 Eric Blake                 <address@hidden>
+Fernando Basso             <address@hidden>
 Florian La Roche           <address@hidden>
 Franc,ois Pinard           <address@hidden>
 Gerald Stoller             <address@hidden>
diff --git a/doc/grep.in.1 b/doc/grep.in.1
index c981f26..e9b4589 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -746,11 +746,6 @@ The preceding item is matched
 .I n
 or more times.
 .TP
-.BI {, m }
-The preceding item is matched at most
-.I m
-times.
-.TP
 .BI { n , m }
 The preceding item is matched at least
 .I n
--
1.7.3.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]