Page MenuHome GnuPG

libgpg-error: argparse: empty header doesn't work well
Closed, ResolvedPublic

Description

ARGPARSE_header (NULL, ""),  /* Stop the header group.  */

Resulted unintended po header output like (LANG=de_DE gpg --help):

Optionen zur Auswahl der Schlüssel:
 -r, --recipient USER-ID            Verschlüsseln für USER-ID
 -u, --local-user USER-ID           Mit USER-ID signieren bzw. entschlüsseln

Project-Id-Version: gnupg-2.3.0
Report-Msgid-Bugs-To: translations@gnupg.org
PO-Revision-Date: 2022-04-25 15:41+0200
Last-Translator: Werner Koch <wk@gnupg.org>
Language-Team: German <de@li.org>
Language: de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=2; plural=n != 1;
:

(Auf der "man"-Seite ist eine vollständige Liste aller Befehle und Optionen)

Event Timeline

Something like this should fix the behavior:

diff --git a/src/argparse.c b/src/argparse.c
index ef0c161..403c4a7 100644
--- a/src/argparse.c
+++ b/src/argparse.c
@@ -3000,7 +3000,13 @@ show_help (opttable_t *opts, unsigned int nopts, unsigned int flags)
         writestrings (0, "Options:", "\n", NULL);
       for (i=0; i < nopts; i++ )
         {
-          s = map_fixed_string (_( opts[ordtbl[i]].description ));
+          if ((opts[ordtbl[i]].flags & ARGPARSE_OPT_HEADER)
+              && opts[ordtbl[i]].description
+              && !*opts[ordtbl[i]].description)
+            /* It's empty header.  */
+            s = opts[ordtbl[i]].description;
+          else
+            s = map_fixed_string (_( opts[ordtbl[i]].description ));
           if ( s && *s== '@' && !s[1] ) /* Hide this line.  */
             continue;
           if ( s && (opts[ordtbl[i]].flags & ARGPARSE_OPT_HEADER))

I pushed a similar fix last week: rE885a287a57cf060b4c
and gnupg has a hack to fix it for oler libgpg-error versions.

I think that there is no need for a ARGPARSE_OPT_HEADER condition because I can't imagine a case where map_fixed_string would take an empty string and map it to something different.

gniibe changed the task status from Open to Testing.Dec 22 2022, 12:51 AM
gniibe triaged this task as High priority.

Ah, I had not done git pull for a week, and I didn't realize your patch.

So, I will close the bug report. But to share the information (among translators), let us keep the ticket for a while as Testing.

Actually, one translator misunderstood it were a new feature (to let people know the translation work).

gniibe claimed this task.

Fixed in 1.47.