]> Savannah Git Hosting - gnulib.git/commitdiff
*printf-posix: Document why it's overridden on some glibc systems.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Mar 2020 21:54:02 +0000 (22:54 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Mar 2020 21:54:02 +0000 (22:54 +0100)
Reported by Adrian Bunk <bunk@stusta.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00011.html>.

* doc/posix-functions/*printf.texi: Document the problem with the %n
directive on some glibc systems.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N): Adjust
the cross-compilation guesses accordingly.

ChangeLog
doc/posix-functions/fprintf.texi
doc/posix-functions/printf.texi
doc/posix-functions/snprintf.texi
doc/posix-functions/sprintf.texi
doc/posix-functions/swprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vsnprintf.texi
doc/posix-functions/vsprintf.texi
m4/printf.m4

index d36c58b98a251b679a7372e34465fc7494bfaf6e..46fce2b50c84416235e5f683f5900bb6c678df18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-03-08  Bruno Haible  <bruno@clisp.org>
+
+       *printf-posix: Document why it's overridden on some glibc systems.
+       Reported by Adrian Bunk <bunk@stusta.de> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00011.html>.
+       * doc/posix-functions/*printf.texi: Document the problem with the %n
+       directive on some glibc systems.
+       * m4/printf.m4 (gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N): Adjust
+       the cross-compilation guesses accordingly.
+
 2020-03-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        open, openat: port to (O_RDWR | O_RDONLY) != 0
index a596bcbbfd6155b000a5121290502d2b43a58827..f55580634f851ab608ca5296aaef4f29e7a3e140 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index 3f00531d33399ed5a9b4662d8e74ed57d9546424..1216656f243a555209334b0dd12606a1005ef228 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index 477931fab3b7f8e10e5e5c22d0b7b75fc6596c0f..6724043a55d14a198a0f04c394d6d4e097e3dff8 100644 (file)
@@ -45,6 +45,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index c43dd152629d4c520fb36d9ab44b86ee7d165adc..a8808990eeefdf43a524011939194454baa65893 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index b5aca13ad33a11867f2b653f42ae80766c5f1244..4d849ae5bda1827a7672d34ee9dabd163d32ab25 100644 (file)
@@ -27,6 +27,7 @@ This function is only defined as a macro on some platforms:
 MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
index 0e7ecba84b226e77e36be7cb26505d5004eb072f..a87219eaa352f82a716b7fd90c8bab33c3557a17 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index 09d9e2b6e23bca4ed3721b59c3cf5d289da943b7..0cb573c25dd50c93cbc81894948aeb4bf938aa07 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index de5258dd24c058e921f69995191ae4050ae48f62..8f2f41065fed7d34762a855c4caf957ad7385d76 100644 (file)
@@ -75,6 +75,7 @@ This function does not truncate the result as specified in C99 on some platforms
 mingw, MSVC 14.
 @item
 This function does not fully support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 HP-UX 11, mingw, MSVC 14.
 @item
 This function overwrites memory even when a zero size argument is passed on some
index 71da5ccfd436aa7791d47c9c97082ad53883f5ae..4e264c7d279d2b323be2dc727ede1f246959123d 100644 (file)
@@ -30,6 +30,7 @@ NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
 Cygwin 1.5.x, mingw, MSVC 14.
 @item
 This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
 MSVC 14.
 @item
 This function does not support the @samp{ls} directive on some platforms:
index 9df21534b1cddaa392050221e6fbae5a6b6f8c48..54a2d71314cdfa0d4d1f958823a214b0a85fd41a 100644 (file)
@@ -1,4 +1,4 @@
-# printf.m4 serial 62
+# printf.m4 serial 63
 dnl Copyright (C) 2003, 2007-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,
@@ -711,6 +711,16 @@ int main ()
         [gl_cv_func_printf_directive_n=yes],
         [gl_cv_func_printf_directive_n=no],
         [case "$host_os" in
+                            # Guess no on glibc when _FORTIFY_SOURCE >= 2.
+           *-gnu* | gnu*)   AC_COMPILE_IFELSE(
+                              [AC_LANG_SOURCE(
+                                 [[#if _FORTIFY_SOURCE >= 2
+                                    error fail
+                                   #endif
+                                 ]])],
+                              [gl_cv_func_printf_directive_n="guessing yes"],
+                              [gl_cv_func_printf_directive_n="guessing no"])
+                            ;;
                             # Guess no on Android.
            linux*-android*) gl_cv_func_printf_directive_n="guessing no";;
                             # Guess no on native Windows.
@@ -1414,8 +1424,16 @@ int main ()
         [
 changequote(,)dnl
          case "$host_os" in
-                                 # Guess yes on glibc systems.
-           *-gnu* | gnu*)        gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess no on glibc when _FORTIFY_SOURCE >= 2.
+           *-gnu* | gnu*)        AC_COMPILE_IFELSE(
+                                   [AC_LANG_SOURCE(
+                                      [[#if _FORTIFY_SOURCE >= 2
+                                         error fail
+                                        #endif
+                                      ]])],
+                                   [gl_cv_func_snprintf_directive_n="guessing yes"],
+                                   [gl_cv_func_snprintf_directive_n="guessing no"])
+                                 ;;
                                  # Guess yes on musl systems.
            *-musl*)              gl_cv_func_snprintf_directive_n="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.