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

[PATCH] t: avoid alternation (not POSIX) in grep's BRE

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
May 28, 2020, 08:37 UTC
Message-ID
<20200528083745.15273-1-carenas@gmail.com>

Using and escaped '|' for alternations is allowed in some implementations of grep (GNU and busybox, al least), but it is no suppored by POSIX[1] and therefore will fail in at least macOS and the BSD.

Change syntax to ERE and use Extended regular expression with grep explicitly.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03
Fixes: f1e3df3169 (t: increase test coverage of signature verification
       output, 2020-03-04)
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 t/t4202-log.sh           | 2 +-
 t/t6200-fmt-merge-msg.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index f1ea7d97f5..a0930599aa 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1692,7 +1692,7 @@ test_expect_success GPG 'log --graph --show-signature for merged tag with missin
 	GNUPGHOME=. git log --graph --show-signature -n1 plain-nokey >actual &&
 	grep "^|\\\  merged tag" actual &&
 	grep "^| | gpg: Signature made" actual &&
-	grep "^| | gpg: Can'"'"'t check signature: \(public key not found\|No public key\)" actual
+	grep -E "^| | gpg: Can'"'"'t check signature: (public key not found|No public key)" actual
 '
 
 test_expect_success GPG 'log --graph --show-signature for merged tag with bad signature' '
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index b15582a7a2..e4c2a6eca4 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -103,7 +103,7 @@ test_expect_success GPG 'message for merging local tag signed by unknown key' '
 	GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 &&
 	grep "^Merge tag ${apos}signed-good-tag${apos}" actual &&
 	grep "^# gpg: Signature made" actual &&
-	grep "^# gpg: Can${apos}t check signature: \(public key not found\|No public key\)" actual
+	grep -E "^# gpg: Can${apos}t check signature: (public key not found|No public key)" actual
 '
 
 test_expect_success 'message for merging external branch' '
-- 
2.27.0.rc2.257.gaada2199e1
Next: Junio C Hamano
Message 1 of 10 in “t: avoid alternation (not POSIX) in grep's BRE”
  1. t: avoid alternation (not POSIX) in grep's BRECarlo Marcelo Arenas Belón, May 28, 2020
  2. Junio C HamanoMay 28, 2020
  3. Jeff KingMay 28, 2020
  4. Junio C HamanoMay 28, 2020
  5. Jeff KingMay 28, 2020
  6. Junio C HamanoMay 28, 2020
  7. Jeff KingMay 28, 2020
  8. digging into historical commit referencesJeff King, May 29, 2020
  9. Torsten BögershausenMay 29, 2020
  10. t: avoid alternation (not POSIX) in grep's BRECarlo Marcelo Arenas Belón, May 29, 2020

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.