[man-db/f17] - resolves: #677669 added support for wildcards in path - resolves: #693458 fixed error with .so

pschiffe pschiffe at fedoraproject.org
Wed Apr 25 17:41:12 UTC 2012


commit 1279200b94d8d67e1ab08be0a77cf75efdc38c5a
Author: Peter Schiffer <pschiffe at redhat.com>
Date:   Wed Apr 25 19:40:46 2012 +0200

    - resolves: #677669
      added support for wildcards in path
    - resolves: #693458
      fixed error with .so links
    - resolves: #806086
      removed hard-dependency on cron, update man db after install or update

 man-db-2.6.1-so-links.patch  |   63 ++++++++++++
 man-db-2.6.1-wildcards.patch |  215 ++++++++++++++++++++++++++++++++++++++++++
 man-db.spec                  |   25 ++++-
 3 files changed, 299 insertions(+), 4 deletions(-)
---
diff --git a/man-db-2.6.1-so-links.patch b/man-db-2.6.1-so-links.patch
new file mode 100644
index 0000000..04f7422
--- /dev/null
+++ b/man-db-2.6.1-so-links.patch
@@ -0,0 +1,63 @@
+diff -upr man-db-2.6.0.2.orig/src/Makefile.am man-db-2.6.0.2/src/Makefile.am
+--- man-db-2.6.0.2.orig/src/Makefile.am	2012-04-25 19:24:02.777149147 +0200
++++ man-db-2.6.0.2/src/Makefile.am	2012-04-25 19:24:34.303581142 +0200
+@@ -85,6 +85,8 @@ lexgrog_SOURCES = \
+ 	descriptions.h \
+ 	filenames.c \
+ 	filenames.h \
++	globbing.c \
++	globbing.h \
+ 	lexgrog.l \
+ 	lexgrog_test.c \
+ 	manconv.c \
+diff -upr man-db-2.6.0.2.orig/src/ult_src.c man-db-2.6.0.2/src/ult_src.c
+--- man-db-2.6.0.2.orig/src/ult_src.c	2011-01-09 21:31:28.000000000 +0100
++++ man-db-2.6.0.2/src/ult_src.c	2012-04-25 19:24:34.304581028 +0200
+@@ -59,6 +59,8 @@
+ #include <unistd.h>
+ 
+ #include "canonicalize.h"
++#include "dirname.h"
++#include "globbing.h"
+ 
+ #include "gettext.h"
+ #define _(String) gettext (String)
+@@ -341,6 +343,38 @@ const char *ult_src (const char *name, c
+ 				free (base);
+ 				base = appendstr (NULL, path, "/", include,
+ 						  NULL);
++
++				/* If the original path from above doesn't exist, try to create
++				 * new path as if the "include" was relative to the current
++				 * man page.
++				 */
++				if (access (base, F_OK) != 0) {
++					char *dirname = mdir_name (name);
++					char *tempFile = appendstr (NULL, dirname, "/", include,
++							NULL);
++					free (dirname);
++					if (access (tempFile, F_OK) == 0) {
++						free (base);
++						base = canonicalize_filename_mode (tempFile,
++								CAN_EXISTING);
++					} else {
++						char *tempFileAsterisk = appendstr (NULL, tempFile,
++								"*", NULL);
++						char **possibleFiles = expand_path (tempFileAsterisk);
++						free (tempFileAsterisk);
++						if (access (possibleFiles[0], F_OK) == 0) {
++							free (base);
++							base = canonicalize_filename_mode (possibleFiles[0],
++									CAN_EXISTING);
++						}
++						int i;
++						for (i = 0; possibleFiles[i] != NULL; i++) {
++							free (possibleFiles[i]);
++						}
++						free (possibleFiles);
++					}
++					free (tempFile);
++				}
+ 				free (include);
+ 
+ 				debug ("ult_src: points to %s\n", base);
diff --git a/man-db-2.6.1-wildcards.patch b/man-db-2.6.1-wildcards.patch
new file mode 100644
index 0000000..b28fcac
--- /dev/null
+++ b/man-db-2.6.1-wildcards.patch
@@ -0,0 +1,215 @@
+diff -upr man-db-2.6.0.2.orig/src/globbing.c man-db-2.6.0.2/src/globbing.c
+--- man-db-2.6.0.2.orig/src/globbing.c	2010-09-26 23:08:14.000000000 +0200
++++ man-db-2.6.0.2/src/globbing.c	2012-04-25 19:07:05.000000000 +0200
+@@ -427,3 +427,30 @@ char **look_for_file (const char *hier, 
+ 	else
+ 		return gbuf.gl_pathv;
+ }
++
++char **expand_path (const char *path)
++{
++	int res = 0;
++	char **result = NULL;
++	glob_t globbuf;
++
++	res = glob (path, 0, NULL, &globbuf);
++	/* if glob failed, return the given path */
++	if (res != 0) {
++		result = (char **) xmalloc (2 * sizeof(char **));
++		result[0] = xstrndup (path, strlen(path));
++		result[1] = NULL;
++		return result;
++	}
++
++	result = (char **) xmalloc ((globbuf.gl_pathc + 1) * sizeof(char **));
++	size_t i;
++	for (i = 0; i < globbuf.gl_pathc; i++) {
++		result[i] = xstrndup (globbuf.gl_pathv[i], strlen (globbuf.gl_pathv[i]));
++	}
++	result[globbuf.gl_pathc] = NULL;
++
++	globfree (&globbuf);
++
++	return result;
++}
+diff -upr man-db-2.6.0.2.orig/src/globbing.h man-db-2.6.0.2/src/globbing.h
+--- man-db-2.6.0.2.orig/src/globbing.h	2008-12-11 00:06:18.000000000 +0100
++++ man-db-2.6.0.2/src/globbing.h	2012-04-25 19:07:05.000000000 +0200
+@@ -29,3 +29,6 @@ enum look_for_file_opts {
+ /* globbing.c */
+ extern char **look_for_file (const char *hier, const char *sec,
+ 			     const char *unesc_name, int cat, int opts);
++
++/* Expand path with wildcards into list of all existing directories. */
++extern char **expand_path (const char *path);
+diff -upr man-db-2.6.0.2.orig/src/Makefile.am man-db-2.6.0.2/src/Makefile.am
+--- man-db-2.6.0.2.orig/src/Makefile.am	2011-03-20 18:49:00.000000000 +0100
++++ man-db-2.6.0.2/src/Makefile.am	2012-04-25 19:07:05.000000000 +0200
+@@ -70,6 +70,8 @@ zsoelim_LDADD = $(LIBMAN) $(libpipeline_
+ accessdb_SOURCES = \
+ 	accessdb.c
+ catman_SOURCES = \
++	globbing.c \
++	globbing.h \
+ 	catman.c \
+ 	manp.c \
+ 	manp.h
+@@ -138,10 +140,14 @@ mandb_SOURCES = \
+ 	ult_src.c \
+ 	ult_src.h
+ manpath_SOURCES = \
++	globbing.c \
++	globbing.h \
+ 	manp.c \
+ 	manp.h \
+ 	manpath.c
+ whatis_SOURCES = \
++	globbing.c \
++	globbing.h \
+ 	manconv.c \
+ 	manconv.h \
+ 	manp.c \
+diff -upr man-db-2.6.0.2.orig/src/manp.c man-db-2.6.0.2/src/manp.c
+--- man-db-2.6.0.2.orig/src/manp.c	2011-04-10 15:44:51.000000000 +0200
++++ man-db-2.6.0.2/src/manp.c	2012-04-25 19:07:05.000000000 +0200
+@@ -75,6 +75,7 @@
+ #endif
+ 
+ #include "manp.h"
++#include "globbing.h"
+ 
+ struct list {
+ 	char *key;
+@@ -1029,32 +1030,45 @@ char *get_manpath_from_path (const char 
+ static void add_dir_to_list (char **lp, const char *dir)
+ {
+ 	int status;
+-	int pos = 0;
+-
+-	while (*lp != NULL) {
+-		if (pos > MAXDIRS - 1)
+-			gripe_overlong_list ();
+-		if (!strcmp (*lp, dir)) {
+-			debug ("%s is already in the manpath\n", dir);
+-			return;
++	int pos = 0, i = 0;
++	char *d = NULL;
++	char **expanded_dirs = NULL;
++
++	expanded_dirs = expand_path (dir);
++	for (i = 0; expanded_dirs[i] != NULL; i++) {
++		d = expanded_dirs[i];
++
++		while (*lp != NULL) {
++			if (pos > MAXDIRS - 1)
++				gripe_overlong_list ();
++			if (!strcmp (*lp, d)) {
++				debug ("%s is already in the manpath\n", d);
++				return;
++			}
++			lp++;
++			pos++;
+ 		}
+-		lp++;
+-		pos++;
+-	}
+ 
+-	/* Not found -- add it. */
++		/* Not found -- add it. */
++
++		status = is_directory (d);
+ 
+-	status = is_directory (dir);
++		if (status < 0)
++			gripe_stat_file (d);
++		else if (status == 0)
++			gripe_not_directory (d);
++		else if (status == 1) {
++			debug ("adding %s to manpath\n", d);
+ 
+-	if (status < 0)
+-		gripe_stat_file (dir);
+-	else if (status == 0)
+-		gripe_not_directory (dir);
+-	else if (status == 1) {
+-		debug ("adding %s to manpath\n", dir);
++			*lp = xstrdup (d);
++		}
+ 
+-		*lp = xstrdup (dir);
++		free (d);
+ 	}
++
++	/* free also the last NULL pointer */
++	free (expanded_dirs[i]);
++	free (expanded_dirs);
+ }
+ 
+ /* path does not exist in config file: check to see if path/../man,
+@@ -1098,33 +1112,47 @@ static inline char *has_mandir (const ch
+ 
+ static char **add_dir_to_path_list (char **mphead, char **mp, const char *p)
+ {
+-	int status;
++	int status, i = 0;
+ 	char *cwd;
++	char *d = NULL;
++	char **expanded_dirs = NULL;
+ 
+ 	if (mp - mphead > MAXDIRS - 1)
+ 		gripe_overlong_list ();
+ 
+-	status = is_directory (p);
+-
+-	if (status < 0)
+-		gripe_stat_file (p);
+-	else if (status == 0)
+-		gripe_not_directory (p);
+-	else {
+-		/* deal with relative paths */
++	expanded_dirs = expand_path (p);
++	for (i = 0; expanded_dirs[i] != NULL; i++) {
++		d = expanded_dirs[i];
++
++		status = is_directory (d);
++
++		if (status < 0)
++			gripe_stat_file (d);
++		else if (status == 0)
++			gripe_not_directory (d);
++		else {
++			/* deal with relative paths */
++
++			if (*d != '/') {
++				cwd = xgetcwd ();
++				if (!cwd)
++					error (FATAL, errno,
++						   _("can't determine current directory"));
++				*mp = appendstr (cwd, "/", d, NULL);
++			} else
++				*mp = xstrdup (d);
+ 
+-		if (*p != '/') {
+-			cwd = xgetcwd ();
+-			if (!cwd)
+-				error (FATAL, errno,
+-				       _("can't determine current directory"));
+-			*mp = appendstr (cwd, "/", p, NULL);
+-		} else 
+-			*mp = xstrdup (p);
++			debug ("adding %s to manpathlist\n", *mp);
++			mp++;
++		}
+ 
+-		debug ("adding %s to manpathlist\n", *mp);
+-		mp++;
++		free (d);
+ 	}
++
++	/* free also the last NULL pointer */
++	free (expanded_dirs[i]);
++	free (expanded_dirs);
++
+ 	return mp;
+ }
+ 
diff --git a/man-db.spec b/man-db.spec
index 9a9085c..959d1be 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: 4%{?dist}
+Release: 5%{?dist}
 # project man-db  GPLv2+
 # Gnulib part     GPLv3+
 License: GPLv2+ and GPLv3+
@@ -16,14 +16,16 @@ Source2: man-db.sysconfig
 Patch1: man-db-2.5.9-sgr.patch
 # Resolves: #702904 - double free or corruption
 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
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Obsoletes: man < 2.0
 Provides: man-pages-reader = %{version}
 Provides: man = %{version}
 BuildRequires: less
-Requires: less, coreutils, grep, groff-base, gzip, crontabs
-BuildRequires: gdbm-devel, groff, gettext, zlib-devel
-BuildRequires: libpipeline-devel
+Requires: less, coreutils, grep, groff-base, gzip
+BuildRequires: gdbm-devel, groff, gettext, zlib-devel, libtool
+BuildRequires: libpipeline-devel, autoconf, gettext-devel, automake
 
 %description
 The man-db package includes five tools for browsing man-pages:
@@ -37,8 +39,11 @@ manual pages.
 %setup -q
 %patch1 -p1 -b .sgr
 %patch2 -p1 -b .double-free
+%patch3 -p1 -b .wildcards
+%patch4 -p1 -b .so-links
 
 %build
+./autogen.sh
 %configure\
     --with-sections="1 1p 8 2 3 3p 4 5 6 7 9 0p n l p o 1x 2x 3x 4x 5x 6x 7x 8x"  \
     --disable-setuid --with-browser=elinks
@@ -82,6 +87,10 @@ 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
+%post
+/bin/bash %{_sysconfdir}/cron.daily/man-db.cron
+
 %files -f %{name}.lang -f %{name}-gnulib.lang
 %defattr(-,root,root,-)
 %doc README man-db-manual.txt man-db-manual.ps docs/COPYING ChangeLog NEWS
@@ -119,6 +128,14 @@ rm -rf $RPM_BUILD_ROOT
 %lang(ja)   %{_datadir}/man/ja/man*/*
 
 %changelog
+* Wed Apr 25 2012 Peter Schiffer <pschiffe at redhat.com> - 2.6.0.2-5
+- resolves: #677669
+  added support for wildcards in path
+- resolves: #693458
+  fixed error with .so links
+- resolves: #806086
+  removed hard-dependency on cron, update man db after install or update
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.6.0.2-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list