Eric Blake wrote: > Even worse. Cygwin 1.5.x appears to do just fine on 2-character strings, > but mishandles 1-character strings, always returning -1, and without > setting errno!
Very weird: on OpenBSD the strings of length 1 work and the larger ones fail, and on Cygwin 1.5 it's just the opposite! > Meanwhile, I'm applying this patch to filter out the brain-dead cygwin > 1.5.x implementation Thanks. Still, I prefer to separate the two tests: It takes more time to understand a test if it's clobbering the input data of the previous test. Also, in the doc I prefer to keep a canonical order of platforms. This makes it easier to compare lists of platforms. The complete list, which you see for example in doc/posix-functions/posix_trace_attr_init.texi, can be memorized as follows: 1) the widely used Unices: glibc 2.3.6, MacOS X 10.3, 2) the other free Unices: FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, 3) the proprietary Unices, sorted alphabetically: AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, 4) the Windows based systems: Cygwin, mingw, Interix 3.5, 5) rarely used and hobbyist systems: BeOS, Haiku, etc. This ordering is quite arbitrary, but sticking to it should help anyway. Hope you don't mind. Bruno 2009-02-28 Bruno Haible <br...@clisp.org> * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): Separate the two first tests. Mention the results of these tests on various platforms. * doc/posix-functions/fprintf.texi: Mention platforms in canonical order. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. --- m4/printf.m4.orig 2009-02-28 15:51:01.000000000 +0100 +++ m4/printf.m4 2009-02-28 15:50:30.000000000 +0100 @@ -653,16 +653,20 @@ { char buf[100]; /* Test whether %ls works at all. - This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, + This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on Cygwin 1.5. */ { - static wchar_t wstring[] = { 'a', 'b', 'c', 0 }; + static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "abc") != 0) return 1; + } + /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an + assertion failure inside libc), but not on OpenBSD 4.0. */ + { + static const wchar_t wstring[] = { 'a', 0 }; buf[0] = '\0'; - wstring[1] = 0; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "a") != 0) return 1; @@ -688,10 +692,10 @@ changequote(,)dnl case "$host_os" in openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; irix*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; *) gl_cv_func_printf_directive_ls="guessing yes";; esac changequote([,])dnl --- doc/glibc-functions/obstack_printf.texi.orig 2009-02-28 15:51:00.000000000 +0100 +++ doc/glibc-functions/obstack_printf.texi 2009-02-28 03:48:43.000000000 +0100 @@ -36,7 +36,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/glibc-functions/obstack_vprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/glibc-functions/obstack_vprintf.texi 2009-02-28 03:48:54.000000000 +0100 @@ -36,7 +36,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/fprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/fprintf.texi 2009-02-28 03:48:33.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/printf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/printf.texi 2009-02-28 03:48:14.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/snprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/snprintf.texi 2009-02-28 03:48:05.000000000 +0100 @@ -41,7 +41,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/sprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/sprintf.texi 2009-02-28 03:47:25.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/vfprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/vfprintf.texi 2009-02-28 03:47:36.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/vprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/vprintf.texi 2009-02-28 03:47:16.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/vsnprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/vsnprintf.texi 2009-02-28 03:48:23.000000000 +0100 @@ -41,7 +41,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: --- doc/posix-functions/vsprintf.texi.orig 2009-02-28 15:51:01.000000000 +0100 +++ doc/posix-functions/vsprintf.texi 2009-02-28 03:47:45.000000000 +0100 @@ -30,7 +30,7 @@ Cygwin 1.5.x, mingw, BeOS. @item This function does not support the @samp{ls} directive on some platforms: -OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, Cygwin 1.5.x. +OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Haiku. @item This function does not support precisions in the @samp{ls} directive correctly on some platforms: