update to 2.7.6.1

- resolves #1403618
This commit is contained in:
Nikola Forró 2017-01-19 10:56:42 +01:00
parent 98f13860c7
commit e2191be5ae
5 changed files with 192 additions and 25 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/man-db-2.7.5.tar.xz /man-db-2.7.5.tar.xz
/man-db-2.7.6.1.tar.xz

View File

@ -1,19 +0,0 @@
From 1d523a44a5ad360c83bff362a625cc68cbe7f296 Mon Sep 17 00:00:00 2001
From: Jan Chaloupka <jchaloup@redhat.com>
Date: Wed, 15 Oct 2014 09:46:56 +0200
Subject: [PATCH] switch man and root in init/systemd/man-db.conf
---
init/systemd/man-db.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/systemd/man-db.conf b/init/systemd/man-db.conf
index 10b27b4..43dd2ad 100644
--- a/init/systemd/man-db.conf
+++ b/init/systemd/man-db.conf
@@ -1 +1 @@
-d /var/cache/man 2755 man root 1w
+d /var/cache/man 2755 root man 1w
--
1.9.3

View File

@ -0,0 +1,177 @@
From 84d6b3fab40be5e1ea288fb296df6cd8be06c985 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
Date: Thu, 19 Jan 2017 10:45:57 +0100
Subject: [PATCH] man(1): Fix override dir handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, override dir was affecting only some cases
of manpath determination.
Apply it only when all paths has been gathered instead.
(Depending on the definition of when the override dir applies,
this might not be correct).
Also look for override dir when sorting candidates.
Fixes src/tests/man-9 failing when --with-override-dir=od
is passed to ./configure.
Reported-by: Nikola Forró <nforro@redhat.com>
Tested-by: Nikola Forró <nforro@redhat.com>
---
src/man.c | 33 +++++++++++++++++++++++++++++++++
src/manp.c | 52 +++++++++++++++++++++-------------------------------
2 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/src/man.c b/src/man.c
index 15a568a..8b11f43 100644
--- a/src/man.c
+++ b/src/man.c
@@ -2665,6 +2665,32 @@ static int duplicate_candidates (struct candidate *left,
return ret;
}
+static int cand1_differs_by_override_dir (const struct candidate *left,
+ const struct candidate *right)
+{
+ size_t ov_len, pre_ov_len;
+
+ ov_len = strlen (OVERRIDE_DIR);
+ if (!ov_len)
+ return 0;
+
+ if (!STREQ (left->source->name, right->source->name))
+ return 0;
+
+ pre_ov_len = strlen(right->path);
+ if (!STRNEQ (left->path, right->path, pre_ov_len))
+ return 0;
+
+ if (left->path[pre_ov_len] != '/')
+ return 0;
+ pre_ov_len++;
+
+ if (STREQ (left->path + pre_ov_len, OVERRIDE_DIR))
+ return 1;
+
+ return 0;
+}
+
static int compare_candidates (const struct candidate *left,
const struct candidate *right)
{
@@ -2749,6 +2775,13 @@ static int compare_candidates (const struct candidate *left,
if (cmp)
return cmp;
+ /* Sort override dir first
+ */
+ if (cand1_differs_by_override_dir(left, right))
+ return -1;
+ if (cand1_differs_by_override_dir(right, left))
+ return 1;
+
/* Try comparing based on language. We used to prefer to display a
* page in the user's preferred language than a page from a better
* section, but that attracted objections, so now we prefer to get
diff --git a/src/manp.c b/src/manp.c
index 0d864f1..b78a50f 100644
--- a/src/manp.c
+++ b/src/manp.c
@@ -931,23 +931,6 @@ static char *def_path (int flag)
}
/*
- * If specified with configure, append OVERRIDE_DIR to dir param and add it
- * to the lp list.
- */
-static void insert_override_dir (char **lp, const char *dir)
-{
- char *override_dir = NULL;
-
- if (!strlen (OVERRIDE_DIR))
- return;
-
- if ((override_dir = xasprintf ("%s/%s", dir, OVERRIDE_DIR))) {
- add_dir_to_list (lp, override_dir);
- free (override_dir);
- }
-}
-
-/*
* For each directory in the user's path, see if it is one of the
* directories listed in the man_db.config file. If so, and it is
* not already in the manpath, add it. If the directory is not listed
@@ -994,8 +977,6 @@ char *get_manpath_from_path (const char *path, int mandatory)
if (mandir_list) {
debug ("is in the config file\n");
while (mandir_list) {
- insert_override_dir (tmplist,
- mandir_list->cont);
add_dir_to_list (tmplist, mandir_list->cont);
mandir_list = iterate_over_list
(mandir_list, p, MANPATH_MAP);
@@ -1014,7 +995,6 @@ char *get_manpath_from_path (const char *path, int mandatory)
"../share/man, or share/man "
"subdirectory\n");
- insert_override_dir (tmplist, t);
add_dir_to_list (tmplist, t);
free (t);
} else
@@ -1030,10 +1010,8 @@ char *get_manpath_from_path (const char *path, int mandatory)
debug ("\nadding mandatory man directories\n\n");
for (list = namestore; list; list = list->next)
- if (list->flag == MANDATORY) {
- insert_override_dir (tmplist, list->key);
+ if (list->flag == MANDATORY)
add_dir_to_list (tmplist, list->key);
- }
}
len = 0;
@@ -1201,18 +1179,30 @@ void create_pathlist (const char *manp, char **mp)
const char *p, *end;
char **mphead = mp;
- /* Expand the manpath into a list for easier handling. */
+ /* Expand the manpath into a list for easier handling.
+ * For each entry, add corresponding OVERRIDE_DIR.
+ * */
for (p = manp;; p = end + 1) {
+ char *element, *element_override;
+ ssize_t p_len;
+
end = strchr (p, ':');
- if (end) {
- char *element = xstrndup (p, end - p);
- mp = add_dir_to_path_list (mphead, mp, element);
- free (element);
- } else {
- mp = add_dir_to_path_list (mphead, mp, p);
- break;
+ p_len = end ? end - p : (ssize_t)strlen(p);
+
+ element = xstrndup (p, p_len);
+
+ if (strlen(OVERRIDE_DIR)) {
+ element_override = xasprintf("%s/%s", element, OVERRIDE_DIR);
+ mp = add_dir_to_path_list (mphead, mp, element_override);
+ free (element_override);
}
+
+ mp = add_dir_to_path_list (mphead, mp, element);
+ free (element);
+
+ if (!end)
+ break;
}
*mp = NULL;
--
2.7.4

View File

@ -3,8 +3,8 @@
Summary: Tools for searching and reading man pages Summary: Tools for searching and reading man pages
Name: man-db Name: man-db
Version: 2.7.5 Version: 2.7.6.1
Release: 3%{?dist} Release: 1%{?dist}
# GPLv2+ .. man-db # GPLv2+ .. man-db
# GPLv3+ .. gnulib # GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+ License: GPLv2+ and GPLv3+
@ -14,7 +14,9 @@ URL: http://www.nongnu.org/man-db/
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
Source1: man-db.crondaily Source1: man-db.crondaily
Source2: man-db.sysconfig Source2: man-db.sysconfig
Patch0: 1151558-switch-man-and-root-in-init-systemd-man-db.conf.patch
# http://lists.nongnu.org/archive/html/man-db-devel/2017-01/msg00013.html
Patch0: man-db-2.7.6.1-fix-override-dir-handling.patch
Obsoletes: man < 2.0 Obsoletes: man < 2.0
Provides: man = %{version} Provides: man = %{version}
@ -24,7 +26,7 @@ Provides: bundled(gnulib) = %{gnulib_ver}
Requires: coreutils, grep, groff-base, gzip, less Requires: coreutils, grep, groff-base, gzip, less
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
BuildRequires: po4a BuildRequires: po4a, perl, perl-version
%description %description
The man-db package includes five tools for browsing man-pages: The man-db package includes five tools for browsing man-pages:
@ -52,7 +54,8 @@ This package provides periodic update of man-db cache.
%build %build
%configure \ %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" \ --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 --with-lzip=lzip \ --disable-setuid --enable-cache-owner=root \
--with-browser=elinks --with-lzip=lzip \
--with-override-dir=overrides --with-override-dir=overrides
make CC="%{__cc} %{optflags}" %{?_smp_mflags} V=1 make CC="%{__cc} %{optflags}" %{?_smp_mflags} V=1
@ -151,6 +154,7 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q
%lang(nl) %{_datadir}/man/nl/man*/* %lang(nl) %{_datadir}/man/nl/man*/*
%lang(pl) %{_datadir}/man/pl/man*/* %lang(pl) %{_datadir}/man/pl/man*/*
%lang(ru) %{_datadir}/man/ru/man*/* %lang(ru) %{_datadir}/man/ru/man*/*
%lang(sv) %{_datadir}/man/sv/man*/*
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/* %lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%files cron %files cron
@ -158,6 +162,10 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q
%config(noreplace) %{_sysconfdir}/sysconfig/man-db %config(noreplace) %{_sysconfdir}/sysconfig/man-db
%changelog %changelog
* Thu Jan 19 2017 Nikola Forró <nforro@redhat.com> - 2.7.6.1-1
- update to 2.7.6.1
resolves #1403618
* Mon Mar 14 2016 Nikola Forró <nforro@redhat.com> - 2.7.5-3 * Mon Mar 14 2016 Nikola Forró <nforro@redhat.com> - 2.7.5-3
- suppress potential locale warning when installing with glibc-minimal-langpack - suppress potential locale warning when installing with glibc-minimal-langpack
resolves #1314633 resolves #1314633

View File

@ -1 +1 @@
37da0bb0400cc7b640f33c26f6052202 man-db-2.7.5.tar.xz SHA512 (man-db-2.7.6.1.tar.xz) = 623c5e7f8b7c289908b2c926f8777293b8d39aeceef0d2509d701a8b0bfa81408650f655c8608318221786c751a79ee91124b07993de5298cd7fa6d8bb737301