bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71470: test failure on CentOS 7


From: Bruno Haible
Subject: bug#71470: test failure on CentOS 7
Date: Mon, 10 Jun 2024 13:56:07 +0200

Building the current grep (git master) with the current Gnulib, I see a test
failure on CentOS 7:


FAIL: test-mbrlen-1.sh
======================

../../gnulib-tests/test-mbrlen.c:47: assertion 'ret == (size_t)(-2)' failed
../../gnulib-tests/test-mbrlen-1.sh: line 5: 31796 Aborted                 
(core dumped) LC_ALL=C ${CHECKER} ./test-mbrlen${EXEEXT} 1
FAIL test-mbrlen-1.sh (exit status: 1)


The background is that mbrlen, on glibc systems <= 2.19, has a bug [1]:
This function returns 0 instead of @code{(size_t) -2} when the input
is empty.
This affects old distros:
  - CentOS 7 (glibc 2.17),
  - Slackware 14 (glibc 2.15),
  - openSUSE 12.1 (glibc 2.14.1),
  - etc.

mbrtowc has the same bug.

Gnulib has workarounds against this bug both in mbrlen and mbrtowc.

But grep deactivates the workaround for mbrtowc, in order not to
slow down 'grep' [2]. When this commit was created, Gnulib had a
mbrtowc-tests module. Now, since 2023-03-30, it also has an mbrlen-tests
module, and it is not deactivated. It fails because
  - mbrlen.m4 detects that mbrlen has the bug.
  - So it activates the replacement REPLACE_MBRLEN=1.
  - The replacement invokes mbrtowc.
  - But mbrtowc is not fixed, due to [2].

I see two reasonable fixes:

a) Remove the special optimization for CentOS 7. This distro will become
unsupported in less than a month [3], therefore it is no longer necessary
to carry complexity to optimize it.
-> patch 0001-maint-Remove-special-optimization-for-CentOS-7.patch

b) Extend the special optimization also to the mbrlen function and tests.
-> 0001-maint-Avoid-test-mbrlen-1.sh-failure-on-CentOS-7.patch

For each of the fixes, find a proposed patch (untested) attached.

Bruno

[1] https://www.gnu.org/software/gnulib/manual/html_node/mbrlen.html
[2] 
https://git.savannah.gnu.org/gitweb/?p=grep.git;a=commitdiff;h=6e319a818ed7b15b452ed2baab2f6a38d42fd1fe
[3] 
https://git.savannah.gnu.org/gitweb/?p=gnulib/maint-tools.git;a=blob;f=end-of-life.txt;h=5b7ff5559f3ddc9ea753f7837c35e8efbe0a8100;hb=HEAD

Attachment: 0001-maint-Remove-special-optimization-for-CentOS-7.patch
Description: Text Data

Attachment: 0001-maint-Avoid-test-mbrlen-1.sh-failure-on-CentOS-7.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]