git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] test-lib-functions: avoid non POSIX ERE in test_dir_is_empty()

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2021, 19:21 UTC
Message-ID
<xmqqfsuwdnbk.fsf@gitster.g>
In-Reply-To
<CAPUEspjGkHhFNgTe3HnnUvkzwHfKqb9dYO3aCXDh_fRyFMRN6A@mail.gmail.com>
Carlo Arenas <carenas@gmail.com> writes:
> egrep (and also fgrep, which we intentionally support because it is
> missing from some ancient AIX system[1]) will be removed in the
> next[2] release of GNU grep.

It is not a reason not to nudge us to prepare for the eventual removal of these two commands, but we need to keep the facts straight in our log messages.

The way I read [2], they will only start giving a warning message nudging the users to use "grep -[EF]", and for them to be able to warn, I would imagine they have to stay in the release without getting removed.

> [1] 87539416fd (tests: grep portability fixes, 2008-09-30)
> [2] https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1

There are about 35 places in t/ we call egrep or fgrep; if we can add a pair of replacement shell functions in t/test-lib.sh for them to use whatever command GIT_TEST_EGREP and GIT_TEST_FGREP environment variables specify and fall back on "grep -E/-F" otherwise, we can prepare for the change without too much code churning.

Something along the lines of
	# in test-lib-functions.sh
        : ${GIT_TEST_EGREP:=grep -E} ${GIT_TEST_FGREP:=grep -F}
        egrep () { $GIT_TEST_EGREP "$@" }
        fgrep () { $GIT_TEST_FGREP "$@" }
where people could do something silly like
	GIT_TEST_FGREP='command fgrep' \
	GIT_TEST_EGREP='command egrep' \
	make test
perhaps?
Previous: Carlo Arenas
Message 6 of 6 in “test-lib-functions: avoid non POSIX ERE in test_dir_is_empty()”
  1. test-lib-functions: avoid non POSIX ERE in test_dir_is_empty()Carlo Marcelo Arenas Belón, Aug 26, 2021
  2. Taylor BlauAug 26, 2021
  3. Junio C HamanoAug 26, 2021
  4. Carlo ArenasAug 26, 2021
  5. Carlo ArenasAug 26, 2021
  6. Junio C HamanoAug 26, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.