bugGNU gettext - Bugs: bug #61794, mingw: fix bug where...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #61794: mingw: fix bug where libintl_swprintf() is not defined, but declared

Submitter:  Johannes Schindelin <dscho>
Submitted:  Tue 11 Jan 2022 10:39:06 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Wed 04 Jan 2023 01:32:03 PM UTC, comment #2: 

The fix is contained in gettext 0.21.1.

Bruno Haible <haible>
Group administrator
Sat 25 Jun 2022 08:45:19 PM UTC, comment #1: 

Thank you very much for the analysis, explanation, and patch!

Applied: https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commit;h=8bf133ed9f6ae83091416b8c63244b64d7b75b2b

Bruno Haible <haible>
Group administrator
Tue 11 Jan 2022 10:39:06 AM UTC, original submission:  

I just provided a fix for a gettext bug to the MSYS2 project, but the fix actually applies to gettext directly. Here is the patch, with an extensive commit message to explain the problem and its resolution:

From b7b09177379f2ee8a56bcd9c98635d4f513d9807 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 10 Jan 2022 23:18:34 +0100
Subject: [PATCH] printf.c: guard the *wprintf() functions by the correct constant

In dcaf8c4d7 (Cygwin portability., 2003-09-17), the *wprintf() family of
functions in `gettext-runtime/intl/printf.c` were no longer guarded by
the constant `HAVE_WPRINTF`, but instead by `HAVE_FWPRINTF`.

This apparently worked even if the corresponding part in
`gettext-runtime/intl/libgnuintl.h.in` uses `HAVE_WPRINTF` to guard the
declarations of those functions.

However, in d84f20745 (Make sure that libintl.h declares the *wprintf
overrides on Windows., 2019-04-08), gettext introduced a change where it
would look for `wprintf()` instead of `fwprintf()`. As a consequence it
would no longer define the `HAVE_FWPRINTF` constant at all.

GCC apparently interprets `#if HAVE_FWPRINTF` as `#if 0` if the constant
has not even been defined.

This leads to the funny situation that previously, the *wprintf()
functions would be defined, but not be declared. Whereas now the
functions are not defined, but declared.

Also funny: Cygwin did not even export the `fwprintf()` function until
2009, as per Cygwin's 45e20e47ba (cygwin.din: Export wprintf,
fwprintf, swprintf, vwprintf, vfwprintf, vswprintf. [...] , 2009-03-06),
while the `wprintf()` function was exported already in 2003. So the
Cygwin portability patch from 2003 seems to have turned off all of the
*wprintf() functions in gettext.

Let's revert that "portability" patch, as it now only does harm and has
no benefit anymore.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 gettext-runtime/intl/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gettext-runtime/intl/printf.c b/gettext-runtime/intl/printf.c
index d327c5ebc..651b3aba0 100644
--- a/gettext-runtime/intl/printf.c
+++ b/gettext-runtime/intl/printf.c
@@ -310,7 +310,7 @@ libintl_asprintf (char **resultp, const char *format, ...)
 
 #endif
 
-#if HAVE_FWPRINTF
+#if HAVE_WPRINTF
 
 #include <wchar.h>
 
--
2.34.1.windows.1


Johannes Schindelin <dscho>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by dscho (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    2022-06-25 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code