[prev in list] [next in list] [prev in thread] [next in thread]
List: gnulib-bug
Subject: Re: new module 'string-buffer'
From: Bruno Haible <bruno () clisp ! org>
Date: 2021-02-27 17:20:28
Message-ID: 1685163.5nx4a6ltbC () omega
[Download RAW message or body]
This patch fixes two issues with this new module.
1) The license 'LGPLv2+' is not possible, because the dependency module
'vsnprintf' is under 'LGPL' (= 'LGPLv3+').
2) The continuous integration reported a test failure. I can reproduce it
- on a Debian 10.7 system,
- on an Ubuntu 16.04 system, but only when specifying CFLAGS that don't
include optimizations. With optimizations, some fortify settings lead
to
gl_cv_func_printf_directive_n=no
gl_cv_func_snprintf_directive_n=no
and thus to
gl_cv_func_vsnprintf_posix=no
and so to
REPLACE_VSNPRINTF=1 .
The Gnulib implementation of vsnprintf() fails when an invalid format
directive is given.
Whereas without optimization, the glibc implementation of vsnprintf
is POSIX compliant, hence REPLACE_VSNPRINTF=0, and since glibc vsnprintf()
does not fail when an invalid format directive is encountered, the
unit test failed.
2021-02-27 Bruno Haible <bruno@clisp.org>
string-buffer: Fixes.
* modules/string-buffer (License): Change to LGPL.
* tests/test-string-buffer.c (main): Add another sb_appendf call, that
is more likely to fail.
diff --git a/modules/string-buffer b/modules/string-buffer
index 4e7827c..54da1db 100644
--- a/modules/string-buffer
+++ b/modules/string-buffer
@@ -20,7 +20,7 @@ Include:
"string-buffer.h"
License:
-LGPLv2+
+LGPL
Maintainer:
all
diff --git a/tests/test-string-buffer.c b/tests/test-string-buffer.c
index 7973559..ecf5160 100644
--- a/tests/test-string-buffer.c
+++ b/tests/test-string-buffer.c
@@ -90,12 +90,19 @@ main ()
free (s);
}
- /* Test printf-like formatting failure. */
+ /* Test printf-like formatting failure.
+ On all systems except AIX, trying to convert the wide-character 0x76543210
+ to a multibyte string (in the "C" locale) fails.
+ On all systems where REPLACE_VSNPRINTF=1 (this includes AIX), i.e. where
+ the Gnulib implementation of vsnprintf() is used), invalid format
+ directives make the *printf call fail. */
{
struct string_buffer buffer;
sb_init (&buffer);
sb_append (&buffer, "<");
+ sb_appendf (&buffer, "%lc", 0x76543210);
+ sb_append (&buffer, "|");
sb_appendf (&buffer, invalid_format_string_1, 1);
sb_append (&buffer, "|");
sb_appendf (&buffer, invalid_format_string_2, 2);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic