[man-db/f17] - resolves: #657409 fixed warning when invoking col by the mandb program in cron - resolves: #8248

pschiffe pschiffe at fedoraproject.org
Thu Jul 12 16:05:13 UTC 2012


commit 3e7ebd1e0e3eba894de45812e2e3a6221e50bd63
Author: Peter Schiffer <pschiffe at redhat.com>
Date:   Thu Jul 12 18:04:50 2012 +0200

    - resolves: #657409
      fixed warning when invoking col by the mandb program in cron
    - resolves: #824825
      apropos returns correct exit code for invalid man page
    - resolves: #829553
      clear the old man cache on install or update

 man-db-2.6.0.2-locale-fallback.patch   |   55 ++++++++++++++++++++++++++++++++
 man-db-2.6.0.2-whatis-error-code.patch |   11 ++++++
 man-db.spec                            |   18 +++++++++--
 3 files changed, 81 insertions(+), 3 deletions(-)
---
diff --git a/man-db-2.6.0.2-locale-fallback.patch b/man-db-2.6.0.2-locale-fallback.patch
new file mode 100644
index 0000000..d3ddc27
--- /dev/null
+++ b/man-db-2.6.0.2-locale-fallback.patch
@@ -0,0 +1,55 @@
+diff -upr man-db-2.6.0.2.orig/lib/encodings.c man-db-2.6.0.2/lib/encodings.c
+--- man-db-2.6.0.2.orig/lib/encodings.c	2011-03-20 02:53:00.000000000 +0100
++++ man-db-2.6.0.2/lib/encodings.c	2012-07-12 17:32:59.748386994 +0200
+@@ -586,14 +586,23 @@ char *find_charset_locale (const char *c
+ 	if (STREQ (charset, get_locale_charset ()))
+ 		return NULL;
+ 
+-	supported = fopen (supported_path, "r");
+-	if (!supported)
+-		return NULL;
+-
+ 	saved_locale = setlocale (LC_CTYPE, NULL);
+ 	if (saved_locale)
+ 		saved_locale = xstrdup (saved_locale);
+ 
++	supported = fopen (supported_path, "r");
++	if (!supported) {
++		if (strlen (charset) >= (size_t) 5
++				&& strncmp (charset, "UTF-8", (size_t) 5) == 0) {
++			locale = "en_US.UTF-8";
++			if (setlocale (LC_CTYPE, locale)) {
++				setlocale (LC_CTYPE, saved_locale);
++				return locale;
++			}
++		}
++		return NULL;
++	}
++
+ 	while (getline (&line, &n, supported) >= 0) {
+ 		const char *space = strchr (line, ' ');
+ 		if (space) {
+diff -upr man-db-2.6.0.2.orig/src/straycats.c man-db-2.6.0.2/src/straycats.c
+--- man-db-2.6.0.2.orig/src/straycats.c	2011-01-09 21:36:53.000000000 +0100
++++ man-db-2.6.0.2/src/straycats.c	2012-07-12 17:31:44.976196785 +0200
+@@ -177,6 +177,7 @@ static int check_for_stray (void)
+ 			char *lang, *page_encoding;
+ 			char *mandir_base;
+ 			pipecmd *col_cmd;
++			char *col_locale;
+ 			char *fullpath;
+ 
+ 			/* we have a straycat. Need to filter it and get
+@@ -226,6 +227,12 @@ static int check_for_stray (void)
+ 			col_cmd = pipecmd_new_argstr
+ 				(get_def_user ("col", COL));
+ 			pipecmd_arg (col_cmd, "-bx");
++			col_locale = find_charset_locale ("UTF-8");
++			if (col_locale) {
++				pipecmd_setenv (col_cmd, "LC_CTYPE",
++						col_locale);
++				free (col_locale);
++			}
+ 			pipeline_command (decomp, col_cmd);
+ 
+ 			fullpath = canonicalize_file_name (catdir);
diff --git a/man-db-2.6.0.2-whatis-error-code.patch b/man-db-2.6.0.2-whatis-error-code.patch
new file mode 100644
index 0000000..7863199
--- /dev/null
+++ b/man-db-2.6.0.2-whatis-error-code.patch
@@ -0,0 +1,11 @@
+diff -upr man-db-2.6.0.2.orig/src/whatis.c man-db-2.6.0.2/src/whatis.c
+--- man-db-2.6.0.2.orig/src/whatis.c	2011-03-20 03:38:48.000000000 +0100
++++ man-db-2.6.0.2/src/whatis.c	2012-07-12 17:52:47.929961438 +0200
+@@ -646,7 +646,6 @@ static int do_apropos (char *page, char 
+ 					display (&info, MYDBM_DPTR (key));
+ 			}
+ 			free (seen_key);
+-			found++;
+ 		} else {
+ 			got_match = parse_name (page, MYDBM_DPTR (key));
+ 			if (got_match)
diff --git a/man-db.spec b/man-db.spec
index 020fcf2..57352b4 100644
--- a/man-db.spec
+++ b/man-db.spec
@@ -3,7 +3,7 @@
 Summary: Tools for searching and reading man pages
 Name: man-db
 Version: 2.6.0.2
-Release: 6%{?dist}
+Release: 7%{?dist}
 # project man-db  GPLv2+
 # Gnulib part     GPLv3+
 License: GPLv2+ and GPLv3+
@@ -18,6 +18,8 @@ Patch1: man-db-2.5.9-sgr.patch
 Patch2: man-db-2.6.0.2-double-free.patch
 Patch3: man-db-2.6.1-wildcards.patch
 Patch4: man-db-2.6.1-so-links.patch
+Patch5: man-db-2.6.0.2-locale-fallback.patch
+Patch6: man-db-2.6.0.2-whatis-error-code.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Obsoletes: man < 2.0
 Provides: man-pages-reader = %{version}
@@ -41,6 +43,8 @@ manual pages.
 %patch2 -p1 -b .double-free
 %patch3 -p1 -b .wildcards
 %patch4 -p1 -b .so-links
+%patch5 -p1 -b .locale-fallback
+%patch6 -p1 -b .whatis-error-code
 
 %build
 ./autogen.sh
@@ -87,9 +91,9 @@ install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-# update the man db after install or update
+# clear the old cache
 %post
-/bin/bash %{_sysconfdir}/cron.daily/man-db.cron
+%{__rm} -rf %{cache}/*
 
 %files -f %{name}.lang -f %{name}-gnulib.lang
 %defattr(-,root,root,-)
@@ -128,6 +132,14 @@ rm -rf $RPM_BUILD_ROOT
 %lang(ja)   %{_datadir}/man/ja/man*/*
 
 %changelog
+* Thu Jul 12 2012 Peter Schiffer <pschiffe at redhat.com> - 2.6.0.2-7
+- resolves: #657409
+  fixed warning when invoking col by the mandb program in cron
+- resolves: #824825
+  apropos returns correct exit code for invalid man page
+- resolves: #829553
+  clear the old man cache on install or update
+
 * Wed May 02 2012 Peter Schiffer <pschiffe at redhat.com> - 2.6.0.2-6
 - resolves: #817514
   updated man-db.cron script


More information about the scm-commits mailing list