Re: [PATCH] tools: perf: Use "grep -E" instead of "egrep"

From: Ian Rogers
Date: Mon Nov 21 2022 - 11:53:16 EST


On Sun, Nov 20, 2022 at 6:59 PM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:
>
>
>
> On 11/20/2022 02:17 AM, Ian Rogers wrote:
> > On Fri, Nov 18, 2022 at 1:17 AM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:
> >>
> >> The latest version of grep claims the egrep is now obsolete so the build
> >> now contains warnings that look like:
> >> egrep: warning: egrep is obsolescent; using grep -E
> >> fix this up by moving the related file to use "grep -E" instead.
> >>
> >> sed -i "s/egrep/grep -E/g" `grep egrep -rwl tools/perf`
> >>
> >> Here are the steps to install the latest grep:
> >>
> >> wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz
> >> tar xf grep-3.8.tar.gz
> >> cd grep-3.8 && ./configure && make
> >> sudo make install
> >> export PATH=/usr/local/bin:$PATH
> >>
> >> Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
> >
> > Hi Tiezhu,
> >
> > installing a newer grep tool in order to build/test perf is somewhat
> > burdensome, as such I don't think we should merge this change. Looking
> > at my Debian derived distro. I have grep 3.7, so I'd need to do this.
> > I imagine the majority of people are using a grep earlier than 3.8. I
> > agree there is a problem perhaps we can:
> > - rewrite to just need grep and not egrep;
> > - rewrite in a stable language with regex support, perhaps python;
> > - have a grep/egrep wrapper that selects based on version number.
> >
>
> Hi Ian,
>
> I found this issue on Linux From Scratch system which uses grep 3.8 [0],
> we can see the following NEWS in grep-3.8 release announcement [1]:
>
> "The egrep and fgrep commands, which have been deprecated since
> release 2.5.3 (2007), now warn that they are obsolescent and should
> be replaced by grep -E and grep -F."
>
> Additionally, the next grep rpm/deb version is 3.8 on Fedora [2]
> and Debian [3], so use "grep -E" instead of "egrep" so we won't see
> the warning for various versions of grep.
>
> [0] https://linuxfromscratch.org/~thomas/multilib/chapter06/grep.html
> [1] https://savannah.gnu.org/forum/forum.php?forum_id=10227
> [2] https://packages.fedoraproject.org/pkgs/grep/grep/fedora-rawhide.html
> [3] https://packages.debian.org/sid/grep
>
> Thanks,
> Tiezhu

Thanks Tiezhu,

My grep is 3.7 and has -E support. In the changelog I see:

```
2021-08-14 Jim Meyering <meyering@xxxxxx>

version 3.7
* NEWS: Record release date.
```

So I'm guessing 3.8 is newer than is necessary for this change, but
demonstrates the warning issue your change addresses. Arnaldo's build
compatibility scripts should be able to spot further issues.

Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

Thanks,
Ian