Hello Santiago,

Thanks for the forward.

It's fixed through
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=d64216aecaf15883c944539657562127b10d0e1a

As this was a regression in version 0.22, I encourage you to apply the fix
(attached) in Debian.

Bruno

>From d64216aecaf15883c944539657562127b10d0e1a Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sat, 27 Jul 2024 21:05:27 +0200
Subject: [PATCH] xgettext: PO: Fix error when a --exclude-file option is
 present (regression 2023-03-10).

Reported by Nicolas Peugnet <n.peug...@free.fr> via Santiago Vila
at <https://lists.gnu.org/archive/html/bug-gettext/2024-07/msg00030.html>.

* gettext-tools/src/x-po.c (extract_add_message): If the message is the header
entry and is among the messages to exclude, save the header charset from it
before discarding it.
---

diff --git a/gettext-tools/src/x-po.c b/gettext-tools/src/x-po.c
index 740aa3d89..a91564535 100644
--- a/gettext-tools/src/x-po.c
+++ b/gettext-tools/src/x-po.c
@@ -1,5 +1,5 @@
 /* xgettext PO, JavaProperties, and NXStringTable backends.
-   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014, 2018, 2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 1995-2024 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <mill...@canb.auug.org.au>
 
@@ -65,10 +65,6 @@ extract_add_message (default_catalog_reader_ty *this,
                      char *prev_msgid_plural,
                      bool force_fuzzy, bool obsolete)
 {
-  /* See whether we shall exclude this message.  */
-  if (exclude != NULL && message_list_search (exclude, msgctxt, msgid) != NULL)
-    goto discard;
-
   /* If the msgid is the empty string, it is the old header.  Throw it
      away, we have constructed a new one.  Only remember its charset.
      But if no new one was constructed, keep the old header.  This is useful
@@ -111,6 +107,10 @@ extract_add_message (default_catalog_reader_ty *this,
       return;
     }
 
+  /* See whether we shall exclude this message.  */
+  if (exclude != NULL && message_list_search (exclude, msgctxt, msgid) != NULL)
+    goto discard;
+
   /* Invoke superclass method.  */
   default_add_message (this, msgctxt, msgid, msgid_pos, msgid_plural,
                        msgstr, msgstr_len, msgstr_pos,

Reply via email to