bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, noloader@gmail.com
Cc: grep-devel@gnu.org
Subject: Re: [platform-testers] new snapshot available: grep-3.4-almost.19-ff30
Date: Sat, 19 Sep 2020 15:12:55 +0200	[thread overview]
Message-ID: <4884197.be5NI9L3Sv@omega> (raw)
In-Reply-To: <CAH8yC8mn1YMN+fgzJBKEk9+y0qTqfO2zHbWUyO2ekVq-PimX3Q@mail.gmail.com>

Jeffrey Walton wrote in
<https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00020.html>:

> Hi Everyone,
> 
> grep-3.4-almost.19-ff30 fails self test on Alpine Linux 3.10 with
> BusyBox, triplet x86_64-pc-linux-gnu.
> 
>   ...
>   FAIL: test-hard-locale
>   FAIL: test-setlocale_null-mt-all
> 
> Attached are config.log and test-suite.log.

The cause of these two failures is the wrong triplet: $host_os is
  - on Alpine Linux 3.10: linux-gnu,
  - on Alpine Linux 3.9 and 3.12: linux-musl.
The triplet comes from config.guess. The test there uses ldd ('ldd --version'
in particular). But on Alpine Linux 3.10 /usr/bin/ldd has been replaced with
a shell script that does not understand the --version option.

This patch fixes it. Part of it can be removed once config.guess will have been
corrected.


2020-09-19  Bruno Haible  <bruno@clisp.org>

	Fix recognition of musl libc on Alpine Linux 3.10.
	Reported by Jeffrey Walton <noloader@gmail.com> in
	<https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00020.html>.
	* m4/musl.m4 (gl_MUSL_CANONICAL_HOST): New macro.
	(gl_MUSL_LIBC): Require it.
	* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Likewise.
	* modules/setlocale-null (Files): Add m4/musl.m4.

diff --git a/m4/musl.m4 b/m4/musl.m4
index 252054c..343c71a 100644
--- a/m4/musl.m4
+++ b/m4/musl.m4
@@ -1,4 +1,4 @@
-# musl.m4 serial 1
+# musl.m4 serial 2
 dnl Copyright (C) 2019-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,10 +9,40 @@ dnl with or without modifications, as long as this notice is preserved.
 # <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>.
 # From Bruno Haible.
 
+# There are three ways to test for musl libc:
+# a. Look at the 'ldd --version' output. This is how config.guess
+#    does it. But it fails on Alpine Linux 3.10, because on this system
+#    'ldd' is a shell script that does not understand the '--version'
+#    option.
+# b. Test whether the header file <bits/alltypes.h> exists.
+# c. Test whether the header file <stdarg.h> defines the macro
+#    __DEFINED_va_list.
+# We use a+c.
+
 AC_DEFUN_ONCE([gl_MUSL_LIBC],
 [
-  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_MUSL_CANONICAL_HOST])
   case "$host_os" in
     *-musl*) AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) ;;
   esac
 ])
+
+# Like AC_CANONICAL_HOST, except for a fix regarding Alpine Linux 3.10.
+
+AC_DEFUN([gl_MUSL_CANONICAL_HOST],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    linux*-gnu*)
+      AC_EGREP_CPP([actually_musl],
+        [#include <stdarg.h>
+         #ifdef __DEFINED_va_list
+          actually_musl
+         #endif
+        ],
+        [host=`echo "$host" | sed -e 's/gnu.*/musl/'`
+         host_os=`echo "$host_os" | sed -e 's/gnu.*/musl/'`
+        ])
+      ;;
+  esac
+])
diff --git a/m4/setlocale_null.m4 b/m4/setlocale_null.m4
index c1ee1f7..20c5c99 100644
--- a/m4/setlocale_null.m4
+++ b/m4/setlocale_null.m4
@@ -1,4 +1,4 @@
-# setlocale_null.m4 serial 2
+# setlocale_null.m4 serial 3
 dnl Copyright (C) 2019-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
 [
-  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_MUSL_CANONICAL_HOST])
   AC_REQUIRE([gl_PTHREADLIB])
   AC_CHECK_HEADERS_ONCE([threads.h])
 
diff --git a/modules/setlocale-null b/modules/setlocale-null
index 2774004..d8c57a2 100644
--- a/modules/setlocale-null
+++ b/modules/setlocale-null
@@ -7,6 +7,7 @@ lib/setlocale_null.c
 lib/setlocale-lock.c
 lib/windows-initguard.h
 m4/setlocale_null.m4
+m4/musl.m4
 m4/threadlib.m4
 m4/visibility.m4
 



  parent reply	other threads:[~2020-09-19 13:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2imce1gpu.fsf@meyering.net>
     [not found] ` <CAH8yC8n4tmO6__C=zP0JZRmc5_ddg7L6uGAuLfjV_Bm+i3oYsA@mail.gmail.com>
2020-09-17 18:23   ` [platform-testers] new snapshot available: grep-3.4-almost.19-ff30 Paul Eggert
2020-09-17 20:53 ` grep-3.4-almost.19-ff30 on Solaris 10 Bruno Haible
2020-09-18  2:26   ` Paul Eggert
2020-09-18  9:01     ` Bruno Haible
2020-09-18 16:06       ` Paul Eggert
2020-09-19  0:25         ` gl_SILENT Bruno Haible
2020-09-17 21:07 ` [platform-testers] new snapshot available: grep-3.4-almost.19-ff30 Jeffrey Walton
2020-09-18 17:36   ` Paul Eggert
     [not found] ` <CAH8yC8mn1YMN+fgzJBKEk9+y0qTqfO2zHbWUyO2ekVq-PimX3Q@mail.gmail.com>
2020-09-17 14:40   ` Jim Meyering
2020-09-17 22:46   ` Bruno Haible
2020-09-19 13:12   ` Bruno Haible [this message]
2020-09-19 14:21     ` Jeffrey Walton
2020-09-19 19:15       ` Bruno Haible
2020-09-20 19:28     ` Bruno Haible
     [not found] <CMM.0.95.0.1600356616.beebe@gamma.math.utah.edu>
2020-09-17 19:22 ` Paul Eggert
2020-09-17 21:31 ` Paul Eggert

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: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4884197.be5NI9L3Sv@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=grep-devel@gnu.org \
    --cc=noloader@gmail.com \
    /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.
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).