Subject: bug#71995: closed (Re: bug#71995: fmbtest unnecessarily skipped on FreeBSD)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 09 Jul 2024 12:49:02 +0000

Your bug report

#71995: fmbtest unnecessarily skipped on FreeBSD

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71995: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71995
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71995: fmbtest unnecessarily skipped on FreeBSD
From: Paul Eggert <[email-masked]>
To: Bruno Haible <[email-masked]>
Cc: [email-masked]
Date: Tue, 9 Jul 2024 14:48:12 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed that.

Subject: fmbtest unnecessarily skipped on FreeBSD
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Mon, 08 Jul 2024 14:14:41 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Building grep-3.11 on FreeBSD 14.0, "make check" reports that the fmbtest
test is skipped:

  fmbtest: skipped test: this system lacks the cs_CZ.UTF-8 locale
  SKIP: fmbtest

But

  $ locale -a | grep cs_CZ
  cs_CZ.ISO8859-2
  cz_CZ.UTF-8

shows that the system does have this locale.

The cause is that this invocation of 'locale' does not work:

  $ locale -k LC_CTYPE
  Unknown keyword: `LC_CTYPE`

But this one works:

  $ locale charmap
  UTF-8

=> Patch attached. It fixes the problem: it makes the test PASS.

'locale charmap' is known to work portably for ages; see
https://git.savannah.gnu.org/gitweb/?p=libiconv.git;a=tree;f=libcharset/tools;h=f756e65e5ea8fef47afc8bb7ae1094e169012c78;hb=HEAD

>From a4501af35dcc7603ee5f500aa87aafe577958010 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Mon, 8 Jul 2024 14:06:16 +0200
Subject: [PATCH] tests: Fix recognition of cs_CZ.UTF-8 locale on FreeBSD.

* tests/fmbtest: Use 'locale charmap' to determine the locale's encoding.
* tests/foad1: Likewise.
---
 tests/fmbtest | 2 +-
 tests/foad1   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fmbtest b/tests/fmbtest
index 38dd49d..f3404fd 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -10,7 +10,7 @@
 cz=cs_CZ.UTF-8
 
 # If cs_CZ.UTF-8 locale doesn't work, skip this test.
-LC_ALL=$cz locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \
+test "`LC_ALL=$cz locale charmap 2>/dev/null`" = UTF-8 \
   || skip_ this system lacks the $cz locale
 
 # If matching is done in single-byte mode, skip this test too
diff --git a/tests/foad1 b/tests/foad1
index 3a29f9e..b87e3f3 100755
--- a/tests/foad1
+++ b/tests/foad1
@@ -150,7 +150,7 @@ Exit $failures
 # The rest of this file is meant to be executed under this locale.
 LC_ALL=cs_CZ.UTF-8; export LC_ALL
 # If the UTF-8 locale doesn't work, skip these tests silently.
-locale -k LC_CTYPE 2>/dev/null | grep -q "charmap.*UTF-8" || Exit $failures
+test "`locale charmap 2>/dev/null`" = UTF-8 || Exit $failures
 
 # Test character class erroneously matching a '[' character.
 grep_test "[/" "" "[[:alpha:]]" -E
-- 
2.34.1