zsh-workers
 help / color / mirror / code / Atom feed
* wcwidth autoconf bug
@ 2012-07-25  9:03 YAMAMOTO Takashi
  2012-07-28 20:06 ` Peter Stephenson
  2012-08-06  6:32 ` YAMAMOTO Takashi
  0 siblings, 2 replies; 6+ messages in thread
From: YAMAMOTO Takashi @ 2012-07-25  9:03 UTC (permalink / raw)
  To: zsh-workers

hi,

the conditional broken_wcwidth seems inverted.

YAMAMOTO Takashi

diff --git a/configure.ac b/configure.ac
index 6c04597..972a8e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2530,8 +2530,8 @@ if test x$zsh_cv_c_unicode_support = xyes; then
   AC_CACHE_CHECK(if the wcwidth() function is broken,
   zsh_cv_c_broken_wcwidth,
   [AC_TRY_RUN([$locale_prog],
-  zsh_cv_c_broken_wcwidth=yes,
   zsh_cv_c_broken_wcwidth=no,
+  zsh_cv_c_broken_wcwidth=yes,
   zsh_cv_c_broken_wcwidth=no)])
   if test x$zsh_cv_c_broken_wcwidth = xyes; then
     AC_DEFINE(BROKEN_WCWIDTH)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wcwidth autoconf bug
  2012-07-25  9:03 wcwidth autoconf bug YAMAMOTO Takashi
@ 2012-07-28 20:06 ` Peter Stephenson
  2012-08-06  6:32 ` YAMAMOTO Takashi
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2012-07-28 20:06 UTC (permalink / raw)
  To: zsh-workers

On Wed, 25 Jul 2012 09:03:41 +0000 (UTC)
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
> the conditional broken_wcwidth seems inverted.

Not as far as I can see.  The programme is designed to return 0
(success) if it's been through all the stages of the test to see if
wcwidth is present but broken.  In that case the variable should be set
to "yes".

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wcwidth autoconf bug
  2012-07-25  9:03 wcwidth autoconf bug YAMAMOTO Takashi
  2012-07-28 20:06 ` Peter Stephenson
@ 2012-08-06  6:32 ` YAMAMOTO Takashi
  2012-08-07  3:12   ` YAMAMOTO Takashi
  1 sibling, 1 reply; 6+ messages in thread
From: YAMAMOTO Takashi @ 2012-08-06  6:32 UTC (permalink / raw)
  To: zsh-workers

hi,

> Not as far as I can see.  The programme is designed to return 0
> (success) if it's been through all the stages of the test to see if
> wcwidth is present but broken.  In that case the variable should be set
> to "yes".

ah, i misunderstood the intention of the code.
thanks for explanation.

YAMAMOTO Takashi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wcwidth autoconf bug
  2012-08-06  6:32 ` YAMAMOTO Takashi
@ 2012-08-07  3:12   ` YAMAMOTO Takashi
  2012-08-07 18:38     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: YAMAMOTO Takashi @ 2012-08-07  3:12 UTC (permalink / raw)
  To: zsh-workers

> hi,
> 
>> Not as far as I can see.  The programme is designed to return 0
>> (success) if it's been through all the stages of the test to see if
>> wcwidth is present but broken.  In that case the variable should be set
>> to "yes".
> 
> ah, i misunderstood the intention of the code.
> thanks for explanation.

even if libc wcwidth is broken in the sense of this test,
it has a far better chance to work than the alternative implementation
on non-__STDC_ISO_10646__ platforms.

YAMAMOTO Takashi

diff --git a/Src/compat.c b/Src/compat.c
index e36de32..6d08dab 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -630,7 +630,7 @@ strtoul(nptr, endptr, base)
 #endif /* HAVE_STRTOUL */
 
 /**/
-#ifdef BROKEN_WCWIDTH
+#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
 
 /*
  * This is an implementation of wcwidth() and wcswidth() (defined in
@@ -949,5 +949,5 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
 #endif /* 0 */
 
 /**/
-#endif /* BROKEN_WCWIDTH */
+#endif /* BROKEN_WCWIDTH && __STDC_ISO_10646__ */
 
diff --git a/Src/zsh.h b/Src/zsh.h
index cc3a670..afe22f0 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2678,7 +2678,7 @@ typedef wint_t convchar_t;
 #define MB_METASTRWIDTH(str)	mb_metastrlen(str, 1)
 #define MB_METASTRLEN2(str, widthp)	mb_metastrlen(str, widthp)
 
-#ifdef BROKEN_WCWIDTH
+#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
 #define WCWIDTH(wc)	mk_wcwidth(wc)
 #else
 #define WCWIDTH(wc)	wcwidth(wc)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wcwidth autoconf bug
  2012-08-07  3:12   ` YAMAMOTO Takashi
@ 2012-08-07 18:38     ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2012-08-07 18:38 UTC (permalink / raw)
  To: zsh-workers

On Tue,  7 Aug 2012 03:12:51 +0000 (UTC)
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
> even if libc wcwidth is broken in the sense of this test,
> it has a far better chance to work than the alternative implementation
> on non-__STDC_ISO_10646__ platforms.

Right, you mean the replacement wcwidth() contains explicit Unicode
characters, so if wchar_t doesn't use Unicode code points it's not doing
us a lot of good.  I've committed it, thanks.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wcwidth autoconf bug
@ 2012-08-23 14:43 Jun T.
  0 siblings, 0 replies; 6+ messages in thread
From: Jun T. @ 2012-08-23 14:43 UTC (permalink / raw)
  To: zsh-workers

On Mac OS X, wcwidth() is broken but __STDC_ISO_10646__ is NOT defined.

(I guess 'if defined(__APPLE__) && defined(BROKEN_WCWIDTH)' would
be enough, but just in case...)


Index: Src/compat.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/compat.c,v
retrieving revision 1.22
diff -u -r1.22 compat.c
--- Src/compat.c	7 Aug 2012 18:29:03 -0000	1.22
+++ Src/compat.c	23 Aug 2012 13:37:29 -0000
@@ -630,7 +630,7 @@
 #endif /* HAVE_STRTOUL */
 
 /**/
-#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
+#if defined(BROKEN_WCWIDTH) && (defined(__STDC_ISO_10646__) || defined(__APPLE__))
 
 /*
  * This is an implementation of wcwidth() and wcswidth() (defined in
@@ -949,5 +949,5 @@
 #endif /* 0 */
 
 /**/
-#endif /* BROKEN_WCWIDTH && __STDC_ISO_10646__ */
+#endif /* BROKEN_WCWIDTH && (__STDC_ISO_10646__ || __APPLE__) */
 
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.183
diff -u -r1.183 zsh.h
--- Src/zsh.h	21 Aug 2012 18:03:03 -0000	1.183
+++ Src/zsh.h	23 Aug 2012 13:37:30 -0000
@@ -2681,7 +2681,7 @@
 #define MB_METASTRWIDTH(str)	mb_metastrlen(str, 1)
 #define MB_METASTRLEN2(str, widthp)	mb_metastrlen(str, widthp)
 
-#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
+#if defined(BROKEN_WCWIDTH) && (defined(__STDC_ISO_10646__) || defined(__APPLE__))
 #define WCWIDTH(wc)	mk_wcwidth(wc)
 #else
 #define WCWIDTH(wc)	wcwidth(wc)




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-23 15:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25  9:03 wcwidth autoconf bug YAMAMOTO Takashi
2012-07-28 20:06 ` Peter Stephenson
2012-08-06  6:32 ` YAMAMOTO Takashi
2012-08-07  3:12   ` YAMAMOTO Takashi
2012-08-07 18:38     ` Peter Stephenson
2012-08-23 14:43 Jun T.

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).