public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Robert Scheck <robert@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/popt] pmatilai-v6: Added patch to have --help and --usage translatable (#734434)
Date: Mon, 23 Nov 2026 09:56:02 GMT	[thread overview]
Message-ID: <179542776285.1.3245751691366252268.rpms-popt-2d86031502c5@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/popt
Branch : pmatilai-v6
Commit : 2d86031502c5359b5bd3ceb596ffc52de1a5342f
Author : Robert Scheck <robert@fedoraproject.org>
Date   : 2014-01-08T20:04:25+01:00
Stats  : +113/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/popt/c/2d86031502c5359b5bd3ceb596ffc52de1a5342f?branch=pmatilai-v6

Log:
Added patch to have --help and --usage translatable (#734434)

---
diff --git a/popt-1.16-help.patch b/popt-1.16-help.patch
new file mode 100644
index 0000000..85fd5ce
--- /dev/null
+++ b/popt-1.16-help.patch
@@ -0,0 +1,107 @@
+Patch initially by Miloslav Trmač <mitr@redhat.com> and revised by Akira Tagoh
+<tagoh@redhat.com> for popt <= 1.16 which fixes the problem that help messages
+for --help and --usage seem not translatable. There already was some i18n support
+for autohelp in popt.c, but not in popthelp.c, where it actually matters.
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=734434 for further details, please.
+
+This patch was proposed to upstream: http://rpm5.org/community/popt-devel/0287.html
+
+--- popt-1.16/popthelp.c			2009-08-28 09:06:33.000000000 +0900
++++ popt-1.16/popthelp.c.help			2014-01-08 12:04:00.888260244 +0900
+@@ -89,7 +89,7 @@ static struct poptOption poptHelpOptions
+   { "defaults", '\0', POPT_ARG_NONE, &show_option_defaults, 0,
+ 	N_("Display option defaults in message"), NULL },
+ #endif
+-  { "", '\0',	0, NULL, 0, N_("Terminate options"), NULL },
++  { NULL, '\0',	0, NULL, 0, N_("Terminate options"), NULL },
+     POPT_TABLEEND
+ } ;
+ 
+@@ -527,8 +527,11 @@ static size_t maxArgWidth(const struct p
+     if (opt != NULL)
+     while (opt->longName || opt->shortName || opt->arg) {
+ 	if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE) {
+-	    if (opt->arg)	/* XXX program error */
+-	        len = maxArgWidth(opt->arg, translation_domain);
++	    void * arg = opt->arg;
++	    /* XXX sick hack to preserve pretense of ABI. */
++	    if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
++	    if (arg)	/* XXX program error */
++		len = maxArgWidth(arg, translation_domain);
+ 	    if (len > max) max = len;
+ 	} else if (!F_ISSET(opt, DOC_HIDDEN)) {
+ 	    len = sizeof("  ")-1;
+@@ -619,19 +622,22 @@ static void singleTableHelp(poptContext
+ 
+     if (table != NULL)
+     for (opt = table; opt->longName || opt->shortName || opt->arg; opt++) {
++	void * arg = opt->arg;
+ 	if (poptArgType(opt) != POPT_ARG_INCLUDE_TABLE)
+ 	    continue;
+-	sub_transdom = getTableTranslationDomain(opt->arg);
++	/* XXX sick hack to preserve pretense of ABI. */
++	if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
++	    sub_transdom = getTableTranslationDomain(arg);
+ 	if (sub_transdom == NULL)
+ 	    sub_transdom = translation_domain;
+ 	    
+ 	/* If no popt aliases/execs, skip poptAliasOption processing. */
+-	if (opt->arg == poptAliasOptions && !(con->numAliases || con->numExecs))
++	if (arg == poptAliasOptions && !(con->numAliases || con->numExecs))
+ 	    continue;
+ 	if (opt->descrip)
+ 	    xx = POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
+ 
+-	singleTableHelp(con, fp, opt->arg, columns, sub_transdom);
++	singleTableHelp(con, fp, arg, columns, sub_transdom);
+     }
+ }
+ 
+@@ -808,22 +814,25 @@ static size_t singleTableUsage(poptConte
+ 	    translation_domain = (const char *)opt->arg;
+ 	} else
+ 	if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE) {
++	    void * arg = opt->arg;
++	    /* XXX sick hack to preserve pretense of ABI. */
++	    if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
+ 	    if (done) {
+ 		int i = 0;
+ 		if (done->opts != NULL)
+ 		for (i = 0; i < done->nopts; i++) {
+ 		    const void * that = done->opts[i];
+-		    if (that == NULL || that != opt->arg)
++		    if (that == NULL || that != arg)
+ 			/*@innercontinue@*/ continue;
+ 		    /*@innerbreak@*/ break;
+ 		}
+ 		/* Skip if this table has already been processed. */
+-		if (opt->arg == NULL || i < done->nopts)
++		if (arg == NULL || i < done->nopts)
+ 		    continue;
+ 		if (done->opts != NULL && done->nopts < done->maxopts)
+-		    done->opts[done->nopts++] = (const void *) opt->arg;
++		    done->opts[done->nopts++] = (const void *) arg;
+ 	    }
+-	    columns->cur = singleTableUsage(con, fp, columns, opt->arg,
++	    columns->cur = singleTableUsage(con, fp, columns, arg,
+ 			translation_domain, done);
+ 	} else
+ 	if ((opt->longName || opt->shortName) && !F_ISSET(opt, DOC_HIDDEN)) {
+@@ -864,9 +873,13 @@ static size_t showShortOptions(const str
+ 	    if (!strchr(s, opt->shortName) && isprint((int)opt->shortName)
+ 	     && opt->shortName != ' ')
+ 		s[strlen(s)] = opt->shortName;
+-	} else if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE)
+-	    if (opt->arg)	/* XXX program error */
+-		len = showShortOptions(opt->arg, fp, s);
++	} else if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE) {
++	    void * arg = opt->arg;
++	    /* XXX sick hack to preserve pretense of ABI. */
++	    if (arg == poptHelpOptions) arg = poptHelpOptionsI18N;
++	    if (arg)	/* XXX program error */
++		len = showShortOptions(arg, fp, s);
++	}
+     } 
+ 
+     /* On return to top level, print the short options, return print length. */

diff --git a/popt.spec b/popt.spec
index 2748ba7..f0351e3 100644
--- a/popt.spec
+++ b/popt.spec
@@ -1,7 +1,7 @@
 Summary:	C library for parsing command line parameters
 Name:		popt
 Version:	1.16
-Release:	1%{?dist}
+Release:	2%{?dist}
 License:	MIT
 Group:		System Environment/Libraries
 URL:		http://www.rpm5.org/
@@ -9,6 +9,7 @@ Source:		http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz
 Patch0:		popt-1.16-pkgconfig.patch
 Patch1:		popt-1.16-execfail.patch
 Patch2:		popt-1.16-man-page.patch
+Patch3:		popt-1.16-help.patch
 BuildRequires:	gettext
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -46,6 +47,7 @@ Install it if you need to link statically with libpopt.
 %patch0 -p1 -b .pkgconfig
 %patch1 -p1 -b .execfail
 %patch2 -p1 -b .man-page
+%patch3 -p1 -b .help
 
 %build
 %if 0%{?fedora} < 17 && 0%{?rhel} < 7
@@ -110,6 +112,9 @@ make check
 %{_libdir}/libpopt.a
 
 %changelog
+* Wed Jan 08 2014 Robert Scheck <robert@fedoraproject.org> 1.16-2
+- Added patch to have --help and --usage translatable (#734434)
+
 * Sun Nov 24 2013 Robert Scheck <robert@fedoraproject.org> 1.16-1
 - Upgrade to 1.16 (#448286, #999377)
 - Tight run-time dependencies between sub-packages via %%{?_isa}

                 reply	other threads:[~2026-11-23  9:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542776285.1.3245751691366252268.rpms-popt-2d86031502c5@fedoraproject.org \
    --to=robert@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox