From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Ville Skyttä" <ville.skytta@iki.fi>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Makefile, git-sh-setup.sh, t/: do not use `egrep` or `fgrep`
Date: Sat, 13 Nov 2021 00:02:41 +0100 [thread overview]
Message-ID: <211113.8635o1ug4g.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20211112225334.1862016-1-ville.skytta@iki.fi>
On Sat, Nov 13 2021, Ville Skyttä wrote:
> `egrep` and `fgrep` have been deprecated in GNU grep since 2007, and in
> current post 3.7 Git they have been made to emit obsolescence warnings.
>
> `grep -E` and `grep -F` on the other hand have been in POSIX and its
> predecessors for decades; use them instead, and use basic regular
> expressions instead of extended ones where applicable.
>
> Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
> ---
> Makefile | 2 +-
> git-sh-setup.sh | 2 +-
> t/perf/run | 4 ++--
> t/t1304-default-acl.sh | 4 ++--
> t/t3700-add.sh | 2 +-
> t/t3702-add-edit.sh | 2 +-
> t/t4014-format-patch.sh | 8 ++++----
> t/t5320-delta-islands.sh | 2 +-
> t/t7003-filter-branch.sh | 4 ++--
> t/t7701-repack-unpack-unreachable.sh | 4 ++--
> t/t9001-send-email.sh | 8 ++++----
> t/t9133-git-svn-nested-git-repo.sh | 6 +++---
> t/t9134-git-svn-ignore-paths.sh | 8 ++++----
> t/t9140-git-svn-reset.sh | 4 ++--
> t/t9147-git-svn-include-paths.sh | 8 ++++----
> t/t9814-git-p4-rename.sh | 2 +-
> t/t9815-git-p4-submit-fail.sh | 4 ++--
> t/test-lib-functions.sh | 2 +-
> 18 files changed, 38 insertions(+), 38 deletions(-)
Sounds sensible, but as far as sane_egrep goes this branch would be
better built on top of my ab/sh-retire-helper-functions, i.e. the
sane_egrep you're changing here will be gone entirely once that merges
down (post-upcoming release, presumably).
On the other hand that conflict is rather minor.
> [...]
> # If move can be disabled, turn it off and test p4 move handling
> diff --git a/t/t9815-git-p4-submit-fail.sh b/t/t9815-git-p4-submit-fail.sh
> index 9779dc0d11..ce75d4debe 100755
> --- a/t/t9815-git-p4-submit-fail.sh
> +++ b/t/t9815-git-p4-submit-fail.sh
> @@ -417,8 +417,8 @@ test_expect_success 'cleanup chmod after submit cancel' '
> ! p4 fstat -T action text &&
> test_path_is_file text+x &&
> ! p4 fstat -T action text+x &&
> - ls -l text | egrep ^-r-- &&
> - ls -l text+x | egrep ^-r-x
> + ls -l text | grep ^-r-- &&
> + ls -l text+x | grep ^-r-x
> )
> '
>
> diff
This looks completely fine since this use is trivial, i.e. let's just
use BRE here.
But just a note that on some implementations BRE & ERE aren't just a
syntax difference, but they dispatch to entirely different regex
engines. I've seen very different performance characteristics with BRE
v.s. ERE, and even cases on some GNU software (can't recall the
specifics now, sorry, I think on glibc) where some things that are
pathological and have runaway memory use on BRE would be just fine on
ERE.
So again, it doesn't matter here, but just since you're poking in this
area a note that -E isn't just "I'm using ERE features". I think it's
probably a good idea to always use it, unles there's a good reason not
to.
prev parent reply other threads:[~2021-11-12 23:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 22:53 [PATCH] Makefile, git-sh-setup.sh, t/: do not use `egrep` or `fgrep` Ville Skyttä
2021-11-12 23:02 ` Ævar Arnfjörð Bjarmason [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=211113.8635o1ug4g.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=ville.skytta@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).