[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building Bison 3.7 with musl (was Re: portability issues with unicod
From: |
Bruno Haible |
Subject: |
Re: Building Bison 3.7 with musl (was Re: portability issues with unicodeio) |
Date: |
Thu, 30 Jul 2020 03:33:46 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
[CCing bug-gnulib. Dropping musl list from CC.]
A. Wilcox wrote in <https://www.openwall.com/lists/musl/2020/07/29/2>:
> Seeing some weird behaviour here building Bison 3.7 on musl libc.
>
> Something seems to be "intelligent" enough to know that \u2022 is a
> bullet character, and is replacing it with "*" instead of ".", causing
> all the tests to fail:
>
> awilcox on gwyn [17] bison: LC_ALL=C /bin/printf '\u2022\n' | od -t x1
> 0000000 2a 0a
> 0000002
Thanks for the report. I see that the recently added 'unicodeio' unit test
fails on musl libc. This patch fixes it.
2020-07-29 Bruno Haible <bruno@clisp.org>
unicodeio: Fix wrong result on musl libc.
Reported by A. Wilcox <awilfox@adelielinux.org> in
<https://www.openwall.com/lists/musl/2020/07/29/2>.
* lib/unicodeio.c (unicode_to_mb): Handle asterisk fallback characters
on musl libc.
* m4/unicodeio.m4 (gl_UNICODEIO): Invoke gl_MUSL_LIBC.
* modules/unicodeio (Files): Add m4/musl.m4.
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index b616e3d..7d5e1fb 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -130,7 +130,7 @@ unicode_to_mb (unsigned int code,
(ICONV_CONST char **)&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (inbytesleft > 0 || res == (size_t)(-1)
- /* Irix iconv() inserts a NUL byte if it cannot convert. */
+ /* Irix iconv() inserts a NUL byte if it cannot convert. */
# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
|| (res > 0 && code != 0 && outptr - outbuf == 1 && *outbuf == '\0')
# endif
@@ -139,6 +139,10 @@ unicode_to_mb (unsigned int code,
# if !defined _LIBICONV_VERSION && (defined __NetBSD__ || defined __sun)
|| (res > 0 && outptr - outbuf == 1 && *outbuf == '?')
# endif
+ /* musl libc iconv() inserts a '*' if it cannot convert. */
+# if !defined _LIBICONV_VERSION && MUSL_LIBC
+ || (res > 0 && outptr - outbuf == 1 && *outbuf == '*')
+# endif
)
return failure (code, NULL, callback_arg);
diff --git a/m4/unicodeio.m4 b/m4/unicodeio.m4
index 11bcd18..a2e9bf0 100644
--- a/m4/unicodeio.m4
+++ b/m4/unicodeio.m4
@@ -1,4 +1,4 @@
-# unicodeio.m4 serial 2
+# unicodeio.m4 serial 3
dnl Copyright (C) 2002-2003, 2009-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,6 +6,6 @@ dnl with or without modifications, as long as this notice is
preserved.
AC_DEFUN([gl_UNICODEIO],
[
- dnl No prerequisites of lib/unicodeio.c.
- :
+ dnl Prerequisites of lib/unicodeio.c.
+ gl_MUSL_LIBC
])
diff --git a/modules/unicodeio b/modules/unicodeio
index 51721db..d7a3a4a 100644
--- a/modules/unicodeio
+++ b/modules/unicodeio
@@ -5,6 +5,7 @@ Files:
lib/unicodeio.h
lib/unicodeio.c
m4/unicodeio.m4
+m4/musl.m4
Depends-on:
unistr/u8-uctomb
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Building Bison 3.7 with musl (was Re: portability issues with unicodeio),
Bruno Haible <=