APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1523364871 -3600
# Tue Apr 10 13:54:31 2018 +0100
# Node ID fddc26a4bf701ec3b4d7c9d855e4ab41788d32f5
# Parent b2979b81a38663cd670146fe85967107dbe9d1eb
Don't use wcwidth() in #'char-width, it's not reliable.
src/ChangeLog addition:
2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in:
No need for HAVE_WCWIDTH anymore.
* unicode.c (unicode_char_columns):
Don't ever use wcwidth() in this function, it's not
reliable, and this gives test failures with
#'truncate-string-to-width. Document what we should use instead.
ChangeLog addition:
2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac (TAB):
No longer check for wcwidth().
diff -r b2979b81a386 -r fddc26a4bf70 ChangeLog
--- a/ChangeLog Tue Apr 10 10:14:38 2018 +0100
+++ b/ChangeLog Tue Apr 10 13:54:31 2018 +0100
@@ -1,3 +1,8 @@
+2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * configure.ac (TAB):
+ No longer check for wcwidth().
+
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac:
diff -r b2979b81a386 -r fddc26a4bf70 configure.ac
--- a/configure.ac Tue Apr 10 10:14:38 2018 +0100
+++ b/configure.ac Tue Apr 10 13:54:31 2018 +0100
@@ -4563,7 +4563,7 @@
dnl Check for POSIX functions.
dnl ----------------------------------------------------------------
-AC_CHECK_FUNCS(cbrt closedir dup2 eaccess fmod fpathconf frexp fsync ftime ftruncate
getaddrinfo gethostname getnameinfo getpagesize getrlimit gettimeofday getcwd link logb
lrand48 matherr mkdir mktime perror poll random readlink rename res_init rint rmdir select
setitimer setpgid setsid sigblock sighold sigprocmask snprintf strerror strlwr strupr
symlink tzset ulimit umask usleep vlimit vsnprintf waitpid wcscmp wcslen wcwidth)
+AC_CHECK_FUNCS(cbrt closedir dup2 eaccess fmod fpathconf frexp fsync ftime ftruncate
getaddrinfo gethostname getnameinfo getpagesize getrlimit gettimeofday getcwd link logb
lrand48 matherr mkdir mktime perror poll random readlink rename res_init rint rmdir select
setitimer setpgid setsid sigblock sighold sigprocmask snprintf strerror strlwr strupr
symlink tzset ulimit umask usleep vlimit vsnprintf waitpid wcscmp wcslen)
dnl getaddrinfo() is borked under hpux11
if test "$ac_cv_func_getaddrinfo" != "no" ; then
diff -r b2979b81a386 -r fddc26a4bf70 src/ChangeLog
--- a/src/ChangeLog Tue Apr 10 10:14:38 2018 +0100
+++ b/src/ChangeLog Tue Apr 10 13:54:31 2018 +0100
@@ -1,3 +1,12 @@
+2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * config.h.in:
+ No need for HAVE_WCWIDTH anymore.
+ * unicode.c (unicode_char_columns):
+ Don't ever use wcwidth() in this function, it's not
+ reliable, and this gives test failures with
+ #'truncate-string-to-width. Document what we should use instead.
+
2018-04-10 Aidan Kehoe <kehoea(a)parhasard.net>
* regex.c (compile_char_class):
diff -r b2979b81a386 -r fddc26a4bf70 src/config.h.in
--- a/src/config.h.in Tue Apr 10 10:14:38 2018 +0100
+++ b/src/config.h.in Tue Apr 10 13:54:31 2018 +0100
@@ -428,7 +428,6 @@
#undef HAVE_WAITPID
#undef HAVE_WCSCMP
#undef HAVE_WCSLEN
-#undef HAVE_WCWIDTH
/* Functions and structs checked for vdb. */
#undef HAVE_MPROTECT
diff -r b2979b81a386 -r fddc26a4bf70 src/unicode.c
--- a/src/unicode.c Tue Apr 10 10:14:38 2018 +0100
+++ b/src/unicode.c Tue Apr 10 13:54:31 2018 +0100
@@ -2661,13 +2661,10 @@
int
unicode_char_columns (int code)
{
-#if defined (HAVE_WCWIDTH) && defined (__STDC_ISO_10646__)
- return wcwidth ((wchar_t) code);
-#else
- /* #### We need to do a much better job here. Although maybe wcwidth()
- is available everywhere we care. @@#### Copy the source for wcwidth().
- Also check under Windows for an equivalent. */
- /* #### Use a range table for this! */
+ /* #### wcwidth() isn't reliable. E.g. Debian GLIBC 2.24-11+deb9u1 gives
+ -1 for ?\uD55c. And of course it varies by platform anyway. This code
+ should instead use a character or range table generated from
+ EastAsianWidth.txt. */
if (
/* Tibetan */
(code >= 0x0F00 && code <= 0x0FFF) ||
@@ -2690,7 +2687,6 @@
(code >= 0x20000 && code <= 0x2FFFF))
return 2;
return 1;
-#endif /* defined (HAVE_WCWIDTH) && defined (__STDC_ISO_10646__) */
}
#endif /* MULE */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date