public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/popt] pmatilai-v6: Revert the broken bind_textdomain_codeset() patch (#433324)
@ 2026-11-23 9:55 Robert Scheck
0 siblings, 0 replies; only message in thread
From: Robert Scheck @ 2026-11-23 9:55 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/popt
Branch : pmatilai-v6
Commit : 548f83f1a4c47456b75102d1de0f3bf6fa957c57
Author : Robert Scheck <robert@fedoraproject.org>
Date : 2008-02-20T09:10:05+00:00
Stats : +126/-162 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/popt/c/548f83f1a4c47456b75102d1de0f3bf6fa957c57?branch=pmatilai-v6
Log:
Revert the broken bind_textdomain_codeset() patch (#433324)
---
diff --git a/popt-1.13-popt_fprintf.patch b/popt-1.13-popt_fprintf.patch
new file mode 100644
index 0000000..a4f972b
--- /dev/null
+++ b/popt-1.13-popt_fprintf.patch
@@ -0,0 +1,119 @@
+Patch by Jeff Johnson <jbj@rpm5.org> for popt >= 1.13, which reverts all POPT_fprintf()
+usage cases to avoid broken umlauts in --help output at some non-UTF8 locales. It should
+not break anything, just restore the behaviour of popt 1.12 again to not introduce a new
+regression. Clueless modified by Robert Scheck <robert@rpm5.org> to hide the last found
+two locale regression as well.
+
+--- popt-1.13/popthelp.c 2007-11-04 16:46:25.000000000 +0100
++++ popt-1.13/popthelp.c.popt_fprintf 2007-12-30 22:10:24.000000000 +0100
+@@ -281,7 +281,6 @@
+ char * left;
+ size_t nb = maxLeftCol + 1;
+ int displaypad = 0;
+- int xx;
+
+ /* Make sure there's more than enough room in target buffer. */
+ if (opt->longName) nb += strlen(opt->longName);
+@@ -406,9 +405,9 @@
+ }
+
+ if (help)
+- xx = POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left);
++ fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left);
+ else {
+- xx = POPT_fprintf(fp," %s\n", left);
++ fprintf(fp," %s\n", left);
+ goto out;
+ }
+
+@@ -428,18 +427,19 @@
+ if (ch == help) break; /* give up */
+ while (ch > (help + 1) && _isspaceptr(ch))
+ ch = POPT_prev_char (ch);
+- ch++;
++ ch = POPT_next_char(ch);
+
+ sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength);
+ /*@-formatconst@*/
+- xx = POPT_fprintf(fp, format, help, " ");
++ fprintf(fp, format, help, " ");
+ /*@=formatconst@*/
+ help = ch;
+- while (_isspaceptr(help) && *help) help++;
++ while (_isspaceptr(help) && *help)
++ help = POPT_next_char(help);
+ helpLength = strlen(help);
+ }
+
+- if (helpLength) xx = POPT_fprintf(fp, "%s\n", help);
++ if (helpLength) fprintf(fp, "%s\n", help);
+ help = NULL;
+
+ out:
+@@ -553,7 +553,6 @@
+ {
+ const struct poptOption * opt;
+ const char *sub_transdom;
+- int xx;
+
+ if (table == poptAliasOptions) {
+ itemHelp(fp, con->aliases, con->numAliases, columns, NULL);
+@@ -577,7 +576,7 @@
+ sub_transdom = translation_domain;
+
+ if (opt->descrip)
+- xx = POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
++ fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
+
+ singleTableHelp(con, fp, opt->arg, columns, sub_transdom);
+ }
+@@ -767,7 +766,7 @@
+ translation_domain = (const char *)opt->arg;
+ } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
+ if (done) {
+- int i;
++ int i = done->nopts;
+ if (done->opts != NULL)
+ for (i = 0; i < done->nopts; i++) {
+ const void * that = done->opts[i];
+--- popt-1.13/poptint.c 2007-11-04 16:56:24.000000000 +0100
++++ popt-1.13/poptint.c.popt_fprintf 2007-12-30 22:10:24.000000000 +0100
+@@ -124,6 +124,18 @@
+ }
+ }
+
++char *
++POPT_next_char (const char *str)
++{
++ char *p = (char *)str;
++
++ while (1) {
++ p++;
++ if ((*p & 0xc0) != (char)0x80)
++ return (char *)p;
++ }
++}
++
+ int
+ POPT_fprintf (FILE* stream, const char *format, ...)
+ {
+--- popt-1.13/poptint.h 2007-12-11 19:02:29.000000000 +0100
++++ popt-1.13/poptint.h.popt_fprintf 2007-12-30 22:10:24.000000000 +0100
+@@ -144,11 +144,14 @@
+ #endif
+ #endif
+
++char *POPT_prev_char (/*@returned@*/ const char *str)
++ /*@*/;
++
++char *POPT_next_char (/*@returned@*/ const char *str)
++ /*@*/;
++
+ int POPT_fprintf (FILE* stream, const char *format, ...)
+ /*@globals fileSystem @*/
+ /*@modifies stream, fileSystem @*/;
+
+-char *POPT_prev_char (/*@returned@*/ const char *str)
+- /*@*/;
+-
+ #endif
diff --git a/popt-1.13-textdomain.patch b/popt-1.13-textdomain.patch
deleted file mode 100644
index e3847ee..0000000
--- a/popt-1.13-textdomain.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-Patch by Takao Fujiwara <takao.fujiwara@sun.com> for popt >= 1.13, which should fix all
-POPT_fprintf() usage cases where umlauts were broken in --help output at some non-UTF8
-locales. Problem is, that some of the applications do not set bind_textdomain_codeset(),
-so this patch is working around it and likely to get upstream for popt 1.13.1.
-
---- popt-1.13/popthelp.c 2008-01-16 02:19:01.000000000 +0900
-+++ popt-1.13/popthelp.c.textdomain 2008-01-25 02:18:08.000000000 +0900
-@@ -15,13 +15,6 @@
- #include <sys/ioctl.h>
- #endif
-
--#define POPT_WCHAR_HACK
--#ifdef POPT_WCHAR_HACK
--#include <wchar.h> /* for mbsrtowcs */
--/*@access mbstate_t @*/
--#endif
--
--
- #include "poptint.h"
-
- /*@access poptContext@*/
-@@ -374,6 +367,16 @@ static void singleOptionHelp(FILE * fp,
- case POPT_ARG_STRING:
- *le++ = (opt->longName != NULL ? '=' : ' ');
- strcpy(le, argDescrip); le += strlen(le);
-+ { const char * scopy = argDescrip;
-+ size_t n = 0;
-+
-+ while (*scopy != '\0') {
-+ scopy = POPT_next_char (scopy);
-+ n++;
-+ }
-+
-+ displaypad = (int) (strlen (argDescrip) - n);
-+ }
- break;
- default:
- break;
-@@ -387,18 +390,17 @@ static void singleOptionHelp(FILE * fp,
- lelen = strlen(le);
- le += lelen;
-
--#ifdef POPT_WCHAR_HACK
- { const char * scopy = argDescrip;
-- mbstate_t t;
-- size_t n;
-+ size_t n = 0;
-
-- memset ((void *)&t, 0, sizeof (t)); /* In initial state. */
- /* Determine number of characters. */
-- n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
-+ while (*scopy != '\0') {
-+ scopy = POPT_next_char (scopy);
-+ n++;
-+ }
-
- displaypad = (int) (lelen-n);
- }
--#endif
- }
- if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
- *le++ = ']';
-@@ -420,6 +422,7 @@ static void singleOptionHelp(FILE * fp,
- helpLength = strlen(help);
- while (helpLength > lineLength) {
- const char * ch;
-+ char * formatted_help = NULL;
- char format[16];
-
- ch = help + lineLength - 1;
-@@ -430,9 +433,12 @@ static void singleOptionHelp(FILE * fp,
- ch = POPT_prev_char (ch);
- ch++;
-
-- sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength);
-+ formatted_help = xstrdup (help);
-+ formatted_help[ch - help] = '\0';
-+ sprintf(format, "%%s\n%%%ds", (int) indentLength);
- /*@-formatconst@*/
-- xx = POPT_fprintf(fp, format, help, " ");
-+ xx = POPT_fprintf(fp, format, formatted_help, " ");
-+ free (formatted_help);
- /*@=formatconst@*/
- help = ch;
- while (_isspaceptr(help) && *help) help++;
-@@ -594,7 +600,7 @@ static size_t showHelpIntro(poptContext
- size_t len = (size_t)6;
- const char * fn;
-
-- fprintf(fp, POPT_("Usage:"));
-+ POPT_fprintf(fp, POPT_("Usage:"));
- if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) {
- /*@-type@*/ /* LCL: wazzup? */
- fn = con->optionStack->argv[0];
-@@ -614,9 +620,9 @@ void poptPrintHelp(poptContext con, FILE
-
- (void) showHelpIntro(con, fp);
- if (con->otherHelp)
-- fprintf(fp, " %s\n", con->otherHelp);
-+ POPT_fprintf(fp, " %s\n", con->otherHelp);
- else
-- fprintf(fp, " %s\n", POPT_("[OPTION...]"));
-+ POPT_fprintf(fp, " %s\n", POPT_("[OPTION...]"));
-
- if (columns) {
- columns->cur = maxArgWidth(con->options, NULL);
---- popt-1.13/poptint.c 2008-01-16 00:28:39.000000000 +0900
-+++ popt-1.13/poptint.c.textdomain 2008-01-25 02:20:34.000000000 +0900
-@@ -2,6 +2,35 @@
- #include <stdarg.h>
- #include "poptint.h"
-
-+const char utf8_skip_data[256] = {
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
-+};
-+
-+#if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
-+char *
-+_D_ (const char * dom, const char * str)
-+{
-+ char * codeset = NULL;
-+ char * retval = NULL;
-+
-+ if (!dom)
-+ dom = textdomain (NULL);
-+ codeset = bind_textdomain_codeset (dom, NULL);
-+ bind_textdomain_codeset (dom, "UTF-8");
-+ retval = dgettext(dom, str);
-+ bind_textdomain_codeset (dom, codeset);
-+
-+ return retval;
-+}
-+#endif
-+
- #ifdef HAVE_ICONV
- static /*@only@*/ /*@null@*/ char *
- strdup_locale_from_utf8 (/*@null@*/ char *buffer)
---- popt-1.13/poptint.h 2008-01-16 02:01:07.000000000 +0900
-+++ popt-1.13/poptint.h.textdomain 2008-01-25 01:44:43.000000000 +0900
-@@ -104,8 +104,10 @@ struct poptContext_s {
- #define _(foo) foo
- #endif
-
-+extern const char utf8_skip_data[];
-+#define POPT_next_char(p) (char *)((p) + utf8_skip_data[*(const unsigned char *)(p)])
- #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
--#define D_(dom, str) dgettext(dom, str)
-+#define D_(dom, str) _D_(dom, str)
- #define POPT_(foo) D_("popt", foo)
- #else
- #define D_(dom, str) str
diff --git a/popt.spec b/popt.spec
index 7b0875c..637ef07 100644
--- a/popt.spec
+++ b/popt.spec
@@ -1,15 +1,15 @@
Summary: C library for parsing command line parameters
Name: popt
Version: 1.13
-Release: 2%{?dist}
+Release: 3%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.rpm5.org/
Source0: http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz
Source1: http://people.redhat.com/jantill/fedora/png-mtime.py
Patch0: popt-1.13-multilib.patch
-Patch1: popt-1.13-textdomain.patch
-BuildRequires: gettext, doxygen, graphviz
+Patch1: popt-1.13-popt_fprintf.patch
+BuildRequires: gettext, doxygen, graphviz, freefont
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
@@ -44,7 +44,7 @@ Install it if you need to link statically with libpopt.
%prep
%setup -q
%patch0 -p1 -b .multilib
-%patch1 -p1 -b .textdomain
+%patch1 -p1 -b .popt_fprintf
%build
%configure --libdir=/%{_lib}
@@ -97,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libpopt.a
%changelog
+* Wed Feb 20 2008 Robert Scheck <robert@fedoraproject.org> 1.13-3
+- Revert the broken bind_textdomain_codeset() patch (#433324)
+
* Thu Feb 14 2008 Robert Scheck <robert@fedoraproject.org> 1.13-2
- Added patch to work around missing bind_textdomain_codeset()
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 9:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 9:55 [rpms/popt] pmatilai-v6: Revert the broken bind_textdomain_codeset() patch (#433324) Robert Scheck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox