[man-db/f17] - resolves: #841431 ignore cached man pages if they don't exist anymore
pschiffe
pschiffe at fedoraproject.org
Tue Jul 31 12:37:00 UTC 2012
commit 3b86ae2d3e52325d74e6a98c31f380067892511a
Author: Peter Schiffer <pschiffe at redhat.com>
Date: Tue Jul 31 14:36:25 2012 +0200
- resolves: #841431
ignore cached man pages if they don't exist anymore
man-db-2.6.2-invalid-cache.patch | 123 ++++++++++++++++++++++++++++++++++++++
man-db.spec | 8 ++-
2 files changed, 130 insertions(+), 1 deletions(-)
---
diff --git a/man-db-2.6.2-invalid-cache.patch b/man-db-2.6.2-invalid-cache.patch
new file mode 100644
index 0000000..f0708a1
--- /dev/null
+++ b/man-db-2.6.2-invalid-cache.patch
@@ -0,0 +1,123 @@
+diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c
+--- man-db-2.6.2.orig/src/check_mandirs.c 2011-07-09 20:53:38.000000000 +0200
++++ man-db-2.6.2/src/check_mandirs.c 2012-07-31 13:05:45.967640117 +0200
+@@ -190,8 +190,7 @@ void test_manfile (const char *file, con
+ comp extensions */
+ abs_filename = make_filename (path, NULL,
+ exists, "man");
+- debug ("test_manfile(): stat %s\n", abs_filename);
+- if (stat (abs_filename, &physical) == -1) {
++ if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
+ if (!opt_test)
+ dbdelete (manpage_base, exists);
+ } else {
+diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c
+--- man-db-2.6.2.orig/src/filenames.c 2011-10-09 01:19:00.000000000 +0200
++++ man-db-2.6.2/src/filenames.c 2012-07-31 12:31:10.436885216 +0200
+@@ -27,6 +27,7 @@
+
+ #include <string.h>
+ #include <stdlib.h>
++#include <unistd.h>
+
+ #include "xvasprintf.h"
+
+@@ -61,6 +62,11 @@ char *make_filename (const char *path, c
+ if (in->comp && *in->comp != '-') /* Is there an extension? */
+ file = appendstr (file, ".", in->comp, NULL);
+
++ if (access (file, R_OK) != 0) {
++ free (file);
++ return NULL;
++ }
++
+ return file;
+ }
+
+diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c
+--- man-db-2.6.2.orig/src/man.c 2012-05-15 01:24:17.000000000 +0200
++++ man-db-2.6.2/src/man.c 2012-07-31 13:04:48.629069419 +0200
+@@ -3103,6 +3103,9 @@ static int add_candidate (struct candida
+ name = req_name;
+
+ filename = make_filename (path, name, source, cat ? "cat" : "man");
++ if (filename == NULL) {
++ return 0;
++ }
+ ult = ult_src (filename, path, NULL,
+ get_ult_flags (from_db, source->id), NULL);
+ free (filename);
+@@ -3309,6 +3312,9 @@ static int display_filesystem (struct ca
+ {
+ char *filename = make_filename (candp->path, NULL, candp->source,
+ candp->cat ? "cat" : "man");
++ if (filename == NULL) {
++ return 0;
++ }
+ /* source->name is never NULL thanks to add_candidate() */
+ char *title = appendstr (NULL, candp->source->name,
+ "(", candp->source->ext, ")", NULL);
+@@ -3392,14 +3398,14 @@ static int display_database (struct cand
+
+ if (in->id < STRAY_CAT) { /* There should be a src page */
+ file = make_filename (candp->path, name, in, "man");
+- debug ("Checking physical location: %s\n", file);
++ if (file != NULL) {
++ debug ("Checking physical location: %s\n", file);
+
+- if (access (file, R_OK) == 0) {
+ const char *man_file;
+ char *cat_file;
+
+ man_file = ult_src (file, candp->path, NULL,
+- get_ult_flags (1, in->id), NULL);
++ get_ult_flags (1, in->id), NULL);
+ if (man_file == NULL) {
+ free (title);
+ return found; /* zero */
+@@ -3416,7 +3422,7 @@ static int display_database (struct cand
+ free (lang);
+ lang = NULL;
+ } /* else {drop through to the bottom and return 0 anyway} */
+- } else
++ } else
+
+ #endif /* NROFF_MISSING */
+
+@@ -3441,9 +3447,9 @@ static int display_database (struct cand
+ }
+
+ file = make_filename (candp->path, name, in, "cat");
+- debug ("Checking physical location: %s\n", file);
+-
+- if (access (file, R_OK) != 0) {
++ if (file != NULL) {
++ debug ("Checking physical location: %s\n", file);
++ } else {
+ char *catpath;
+ catpath = get_catpath (candp->path,
+ global_manpath ? SYSTEM_CAT
+@@ -3453,10 +3459,10 @@ static int display_database (struct cand
+ file = make_filename (catpath, name,
+ in, "cat");
+ free (catpath);
+- debug ("Checking physical location: %s\n",
+- file);
+-
+- if (access (file, R_OK) != 0) {
++ if (file != NULL) {
++ debug ("Checking physical location: %s\n",
++ file);
++ } else {
+ /* don't delete here,
+ return==0 will do that */
+ free (title);
+@@ -3520,6 +3526,8 @@ static int maybe_update_file (const char
+ real_name = name;
+
+ file = make_filename (manpath, real_name, info, "man");
++ if (file == NULL)
++ return 0;
+ if (lstat (file, &buf) != 0)
+ return 0;
+ if (buf.st_mtime == info->_st_mtime)
diff --git a/man-db.spec b/man-db.spec
index 57352b4..bf82453 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: 7%{?dist}
+Release: 8%{?dist}
# project man-db GPLv2+
# Gnulib part GPLv3+
License: GPLv2+ and GPLv3+
@@ -20,6 +20,7 @@ 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
+Patch7: man-db-2.6.2-invalid-cache.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: man < 2.0
Provides: man-pages-reader = %{version}
@@ -45,6 +46,7 @@ manual pages.
%patch4 -p1 -b .so-links
%patch5 -p1 -b .locale-fallback
%patch6 -p1 -b .whatis-error-code
+%patch7 -p1 -b .invalid-cache
%build
./autogen.sh
@@ -132,6 +134,10 @@ rm -rf $RPM_BUILD_ROOT
%lang(ja) %{_datadir}/man/ja/man*/*
%changelog
+* Tue Jul 31 2012 Peter Schiffer <pschiffe at redhat.com> - 2.6.0.2-8
+- resolves: #841431
+ ignore cached man pages if they don't exist anymore
+
* 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
More information about the scm-commits
mailing list