parent
293922b07a
commit
d94aa53b87
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
||||
/man-db-2.9.4.tar.xz
|
||||
/man-db-2.10.0.tar.xz
|
||||
/man-db-2.10.1.tar.xz
|
||||
/man-db-2.10.2.tar.xz
|
||||
|
@ -1,202 +0,0 @@
|
||||
From b8483c4db97f6f879fe5e532a2ec66e9363033c9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
||||
Date: Tue, 27 Aug 2019 17:53:03 +0200
|
||||
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, 53 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/man.c b/src/man.c
|
||||
index f16fae8..29c8671 100644
|
||||
--- a/src/man.c
|
||||
+++ b/src/man.c
|
||||
@@ -2728,6 +2728,32 @@ static bool 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)
|
||||
{
|
||||
@@ -2817,6 +2843,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 80b309a..4e3bff0 100644
|
||||
--- a/src/manp.c
|
||||
+++ b/src/manp.c
|
||||
@@ -911,23 +911,6 @@ static char *def_path (enum config_flag flag)
|
||||
return manpath;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * If specified with configure, append OVERRIDE_DIR to dir param and add it
|
||||
- * to list.
|
||||
- */
|
||||
-static void insert_override_dir (gl_list_t list, 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 (list, 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
|
||||
@@ -976,7 +959,6 @@ char *get_manpath_from_path (const char *path, int mandatory)
|
||||
if (!manpath_map_found)
|
||||
debug ("is in the config file\n");
|
||||
manpath_map_found = true;
|
||||
- insert_override_dir (tmplist, config_item->cont);
|
||||
add_dir_to_list (tmplist, config_item->cont);
|
||||
}
|
||||
|
||||
@@ -998,8 +980,6 @@ char *get_manpath_from_path (const char *path, int mandatory)
|
||||
|
||||
GL_LIST_FOREACH (config, config_item) {
|
||||
if (config_item->flag == MANDATORY) {
|
||||
- insert_override_dir (tmplist,
|
||||
- config_item->key);
|
||||
add_dir_to_list (tmplist, config_item->key);
|
||||
}
|
||||
}
|
||||
@@ -1084,7 +1064,6 @@ static void add_man_subdirs (gl_list_t list, const char *path)
|
||||
if (subdir) {
|
||||
newpath = xasprintf ("%.*s/man", (int) (subdir - path), path);
|
||||
if (is_directory (newpath) == 1) {
|
||||
- insert_override_dir (list, newpath);
|
||||
add_dir_to_list (list, newpath);
|
||||
}
|
||||
free (newpath);
|
||||
@@ -1092,7 +1071,6 @@ static void add_man_subdirs (gl_list_t list, const char *path)
|
||||
|
||||
newpath = xasprintf ("%s/man", path);
|
||||
if (is_directory (newpath) == 1) {
|
||||
- insert_override_dir (list, newpath);
|
||||
add_dir_to_list (list, newpath);
|
||||
}
|
||||
free (newpath);
|
||||
@@ -1101,7 +1079,6 @@ static void add_man_subdirs (gl_list_t list, const char *path)
|
||||
newpath = xasprintf ("%.*s/share/man",
|
||||
(int) (subdir - path), path);
|
||||
if (is_directory (newpath) == 1) {
|
||||
- insert_override_dir (list, newpath);
|
||||
add_dir_to_list (list, newpath);
|
||||
}
|
||||
free (newpath);
|
||||
@@ -1109,7 +1086,6 @@ static void add_man_subdirs (gl_list_t list, const char *path)
|
||||
|
||||
newpath = xasprintf ("%s/share/man", path);
|
||||
if (is_directory (newpath) == 1) {
|
||||
- insert_override_dir (list, newpath);
|
||||
add_dir_to_list (list, newpath);
|
||||
}
|
||||
free (newpath);
|
||||
@@ -1205,7 +1181,9 @@ gl_list_t create_pathlist (const char *manp)
|
||||
const struct canonicalized_path *cp;
|
||||
|
||||
/* Expand the manpath into a list of (path, canonicalized path)
|
||||
- * pairs for easier handling. add_dir_to_path_list only adds items
|
||||
+ * pairs for easier handling. For each entry, add corresponding
|
||||
+ * OVERRIDE_DIR.
|
||||
+ * add_dir_to_path_list only adds items
|
||||
* if they do not have the same canonicalized path as an existing
|
||||
* item, thereby eliminating duplicates due to symlinks.
|
||||
*/
|
||||
@@ -1214,15 +1192,25 @@ gl_list_t create_pathlist (const char *manp)
|
||||
(GL_LINKEDHASH_LIST, canonicalized_path_equals,
|
||||
canonicalized_path_hash, canonicalized_path_free, false);
|
||||
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);
|
||||
- add_dir_to_path_list (canonicalized_list, element);
|
||||
- free (element);
|
||||
- } else {
|
||||
- add_dir_to_path_list (canonicalized_list, 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);
|
||||
+ add_dir_to_path_list (canonicalized_list, element_override);
|
||||
+ free (element_override);
|
||||
}
|
||||
+
|
||||
+ add_dir_to_path_list (canonicalized_list, element);
|
||||
+ free (element);
|
||||
+
|
||||
+ if (!end)
|
||||
+ break;
|
||||
}
|
||||
|
||||
list = new_string_list (GL_ARRAY_LIST, false);
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,19 +0,0 @@
|
||||
From 99dd120b952a2a27fa31ae005149e6aaaed28755 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
||||
Date: Fri, 6 Apr 2018 11:52:33 +0200
|
||||
Subject: [PATCH] Set owner of man cache to root
|
||||
|
||||
---
|
||||
init/systemd/man-db.conf.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/init/systemd/man-db.conf.in b/init/systemd/man-db.conf.in
|
||||
index 7a461e8..cac2b52 100644
|
||||
--- a/init/systemd/man-db.conf.in
|
||||
+++ b/init/systemd/man-db.conf.in
|
||||
@@ -1 +1 @@
|
||||
-d /var/cache/man 0755 @cache_top_owner@ @cache_top_owner@ 1w
|
||||
+d /var/cache/man 0755 root root 1w
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,13 +0,0 @@
|
||||
diff --git a/src/man_db.conf.in b/src/man_db.conf.in
|
||||
index 2942000..6365ca0 100644
|
||||
--- a/src/man_db.conf.in
|
||||
+++ b/src/man_db.conf.in
|
||||
@@ -69,7 +69,7 @@ MANDB_MAP /usr/local/man /var/cache/man/oldlocal
|
||||
MANDB_MAP /usr/local/share/man /var/cache/man/local
|
||||
MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6
|
||||
MANDB_MAP /opt/man /var/cache/man/opt
|
||||
-MANDB_MAP /snap/man /var/cache/man/snap
|
||||
+MANDB_MAP /var/lib/snapd/snap/man /var/cache/man/snap
|
||||
#
|
||||
#---------------------------------------------------------
|
||||
# Program definitions. These are commented out by default as the value
|
18
man-db.spec
18
man-db.spec
@ -1,9 +1,8 @@
|
||||
%global cache /var/cache/man
|
||||
%global gnulib_ver 20140202
|
||||
|
||||
Summary: Tools for searching and reading man pages
|
||||
Name: man-db
|
||||
Version: 2.10.1
|
||||
Version: 2.10.2
|
||||
Release: 1%{?dist}
|
||||
# GPLv2+ .. man-db
|
||||
# GPLv3+ .. gnulib
|
||||
@ -15,20 +14,12 @@ Source1: man-db.crondaily
|
||||
Source2: man-db.sysconfig
|
||||
Source3: man-db-cache-update.service
|
||||
Source4: man-db-restart-cache-update.service
|
||||
Patch0: man-db-2.8.3-change-owner-of-man-cache.patch
|
||||
|
||||
# http://lists.nongnu.org/archive/html/man-db-devel/2017-01/msg00013.html
|
||||
Patch1: man-db-2.10.0-fix-override-dir-handling.patch
|
||||
|
||||
# change snap system directory from /snap to /var/lib/snapd/snap
|
||||
# https://lists.gnu.org/archive/html/man-db-devel/2020-02/msg00000.html
|
||||
Patch2: man-db-2.9.1-snap.patch
|
||||
|
||||
Obsoletes: man < 2.0
|
||||
Provides: man = %{version}
|
||||
Provides: man-pages-reader = %{version}
|
||||
# FPC exception for gnulib - copylib - https://fedorahosted.org/fpc/ticket/174
|
||||
Provides: bundled(gnulib) = %{gnulib_ver}
|
||||
Provides: bundled(gnulib)
|
||||
|
||||
Requires: coreutils, grep, groff-base, gzip, less
|
||||
BuildRequires: make
|
||||
@ -69,6 +60,7 @@ This package provides periodic update of man-db cache.
|
||||
--disable-setuid --disable-cache-owner \
|
||||
--with-systemdsystemunitdir=no \
|
||||
--with-browser=elinks --with-lzip=lzip \
|
||||
--with-snapdir=/var/lib/snapd/snap \
|
||||
--with-override-dir=overrides
|
||||
%make_build CC="%{__cc} %{optflags}"
|
||||
|
||||
@ -233,6 +225,10 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
|
||||
|
||||
%changelog
|
||||
* Fri Mar 18 2022 Nikola Forró <nforro@redhat.com> - 2.10.2-1
|
||||
- update to 2.10.2
|
||||
resolves: #2065447
|
||||
|
||||
* Fri Feb 11 2022 Nikola Forró <nforro@redhat.com> - 2.10.1-1
|
||||
- update to 2.10.1
|
||||
resolves #2053020
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (man-db-2.10.1.tar.xz) = 25a3c4e3d7b171faf0771885a7a7d502c4af801881777231c79d7ee9768c2e48e44afbf5603af13f5ac63e6981cfdb8e36ba8a33d5f926d8122635cf45fcff7a
|
||||
SHA512 (man-db-2.10.2.tar.xz) = 5ad7a7b601aadf4d2d7cc068881fffe3d91dc85fcf4c17e66fbe6e2b04bb1c46f5ba5d4bc7f6ab3f39e00065be39061b101d3064c12b1e89f0fee61c088611bf
|
||||
|
Loading…
Reference in New Issue
Block a user