Compare commits
No commits in common. 'c9' and 'i8c' have entirely different histories.
@ -1 +1 @@
|
||||
SOURCES/man-db-2.9.3.tar.xz
|
||||
SOURCES/man-db-2.7.6.1.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
76ec7a9f5222fbd6fc5364929270a4790094a617 SOURCES/man-db-2.9.3.tar.xz
|
||||
919dcb34d604faac9b18a38ead07f457d0dab501 SOURCES/man-db-2.7.6.1.tar.xz
|
||||
|
@ -0,0 +1,19 @@
|
||||
From b872ee2e8ba470ed869db7dcf37eeb96563a62fa Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
||||
Date: Thu, 19 Jan 2017 14:06:30 +0100
|
||||
Subject: [PATCH] Set owner of man cache to root instead of man
|
||||
|
||||
---
|
||||
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 1eb40ce..21936d5 100644
|
||||
--- a/init/systemd/man-db.conf
|
||||
+++ b/init/systemd/man-db.conf
|
||||
@@ -1 +1 @@
|
||||
-d /var/cache/man 0755 man man 1w
|
||||
+d /var/cache/man 0755 root root 1w
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,188 @@
|
||||
diff --git a/gnulib/lib/getopt.c b/gnulib/lib/getopt.c
|
||||
index 7d950af..fa30f13 100644
|
||||
--- a/gnulib/lib/getopt.c
|
||||
+++ b/gnulib/lib/getopt.c
|
||||
@@ -487,7 +487,15 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||
const struct option *p;
|
||||
struct option_list *next;
|
||||
} *ambig_list = NULL;
|
||||
+# define free_option_list(l) \
|
||||
+ while (l != NULL) \
|
||||
+ { \
|
||||
+ struct option_list *pn = l->next; \
|
||||
+ free (l); \
|
||||
+ l = pn; \
|
||||
+ }
|
||||
int exact = 0;
|
||||
+ int ambig = 0;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
|
||||
@@ -521,15 +529,25 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||
{
|
||||
/* Second or later nonexact match found. */
|
||||
struct option_list *newp = malloc (sizeof (*newp));
|
||||
- newp->p = p;
|
||||
- newp->next = ambig_list;
|
||||
- ambig_list = newp;
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ ambig = 1; /* Use simpler fallback message. */
|
||||
+ free_option_list (ambig_list);
|
||||
+ ambig_list = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ newp->p = p;
|
||||
+ newp->next = ambig_list;
|
||||
+ ambig_list = newp;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
- if (ambig_list != NULL && !exact)
|
||||
+ if ((ambig || ambig_list) && !exact)
|
||||
{
|
||||
- if (print_errors)
|
||||
+ if (print_errors && ambig_list)
|
||||
{
|
||||
struct option_list first;
|
||||
first.p = pfound;
|
||||
@@ -585,18 +603,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||
fputc ('\n', stderr);
|
||||
#endif
|
||||
}
|
||||
+ else if (print_errors && ambig)
|
||||
+ {
|
||||
+ fprintf (stderr,
|
||||
+ _("%s: option '%s' is ambiguous\n"),
|
||||
+ argv[0], argv[d->optind]);
|
||||
+ }
|
||||
d->__nextchar += strlen (d->__nextchar);
|
||||
d->optind++;
|
||||
d->optopt = 0;
|
||||
+ free_option_list (ambig_list);
|
||||
return '?';
|
||||
}
|
||||
|
||||
- while (ambig_list != NULL)
|
||||
- {
|
||||
- struct option_list *pn = ambig_list->next;
|
||||
- free (ambig_list);
|
||||
- ambig_list = pn;
|
||||
- }
|
||||
+ free_option_list (ambig_list);
|
||||
|
||||
if (pfound != NULL)
|
||||
{
|
||||
diff --git a/lib/decompress.c b/lib/decompress.c
|
||||
index a176a9d..2be532f 100644
|
||||
--- a/lib/decompress.c
|
||||
+++ b/lib/decompress.c
|
||||
@@ -48,11 +48,18 @@
|
||||
static void decompress_zlib (void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
gzFile zlibfile;
|
||||
+ int fd;
|
||||
|
||||
- zlibfile = gzdopen (dup (STDIN_FILENO), "r");
|
||||
- if (!zlibfile)
|
||||
+ fd = dup (STDIN_FILENO);
|
||||
+ if (fd < 0)
|
||||
return;
|
||||
|
||||
+ zlibfile = gzdopen (fd, "r");
|
||||
+ if (!zlibfile) {
|
||||
+ close (fd);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
for (;;) {
|
||||
char buffer[4096];
|
||||
int r = gzread (zlibfile, buffer, 4096);
|
||||
diff --git a/lib/encodings.c b/lib/encodings.c
|
||||
index d982827..ec8fb6b 100644
|
||||
--- a/lib/encodings.c
|
||||
+++ b/lib/encodings.c
|
||||
@@ -605,8 +605,10 @@ char *find_charset_locale (const char *charset)
|
||||
if (setlocale (LC_CTYPE, locale)) {
|
||||
free (encoding);
|
||||
goto out;
|
||||
- } else
|
||||
+ } else {
|
||||
+ free (locale);
|
||||
locale = NULL;
|
||||
+ }
|
||||
}
|
||||
free (encoding);
|
||||
}
|
||||
diff --git a/src/man.c b/src/man.c
|
||||
index cb0930b..12dca6e 100644
|
||||
--- a/src/man.c
|
||||
+++ b/src/man.c
|
||||
@@ -1404,6 +1404,7 @@ static pipeline *make_roff_command (const char *dir, const char *file,
|
||||
pipeline_command (p, cmd);
|
||||
}
|
||||
|
||||
+ free (fmt_prog);
|
||||
free (page_encoding);
|
||||
free (raw_pp_string);
|
||||
return p;
|
||||
diff --git a/src/mandb.c b/src/mandb.c
|
||||
index 550af8f..7ae0d02 100644
|
||||
--- a/src/mandb.c
|
||||
+++ b/src/mandb.c
|
||||
@@ -555,7 +555,7 @@ static int process_manpath (const char *manpath, int global_manpath,
|
||||
struct tried_catdirs_entry *tried;
|
||||
struct stat st;
|
||||
int run_mandb = 0;
|
||||
- struct dbpaths *dbpaths;
|
||||
+ struct dbpaths *dbpaths = NULL;
|
||||
int amount = 0;
|
||||
|
||||
if (global_manpath) { /* system db */
|
||||
@@ -571,8 +571,10 @@ static int process_manpath (const char *manpath, int global_manpath,
|
||||
tried->seen = 0;
|
||||
hashtable_install (tried_catdirs, catpath, strlen (catpath), tried);
|
||||
|
||||
- if (stat (manpath, &st) < 0 || !S_ISDIR (st.st_mode))
|
||||
- return 0;
|
||||
+ if (stat (manpath, &st) < 0 || !S_ISDIR (st.st_mode)) {
|
||||
+ amount = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
tried->seen = 1;
|
||||
|
||||
if (single_filename) {
|
||||
@@ -615,10 +617,13 @@ static int process_manpath (const char *manpath, int global_manpath,
|
||||
#endif /* SECURE_MAN_UID */
|
||||
|
||||
out:
|
||||
- cleanup_sigsafe (dbpaths);
|
||||
- pop_cleanup (cleanup_sigsafe, dbpaths);
|
||||
- cleanup (dbpaths);
|
||||
- pop_cleanup (cleanup, dbpaths);
|
||||
+ if (dbpaths) {
|
||||
+ cleanup_sigsafe (dbpaths);
|
||||
+ pop_cleanup (cleanup_sigsafe, dbpaths);
|
||||
+ cleanup (dbpaths);
|
||||
+ pop_cleanup (cleanup, dbpaths);
|
||||
+ }
|
||||
+
|
||||
free (database);
|
||||
database = NULL;
|
||||
|
||||
diff --git a/src/whatis.c b/src/whatis.c
|
||||
index 4cf14a5..f804c0e 100644
|
||||
--- a/src/whatis.c
|
||||
+++ b/src/whatis.c
|
||||
@@ -810,6 +810,8 @@ nextpage:
|
||||
free_mandata_elements (&info);
|
||||
}
|
||||
|
||||
+ free (found_here);
|
||||
+
|
||||
for (i = 0; i < num_pages; ++i)
|
||||
free (lowpages[i]);
|
||||
free (lowpages);
|
@ -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
|
||||
|
@ -0,0 +1,90 @@
|
||||
From 79308ac147be9e9c889798cba78bab2af05048e1 Mon Sep 17 00:00:00 2001
|
||||
From: Jiri Kucera <jkucera@redhat.com>
|
||||
Date: Wed, 17 Jan 2018 13:57:34 +0100
|
||||
Subject: [PATCH] Fix a segfault in 'man -D --help'
|
||||
|
||||
This patch is an adjusted version (due to the patch rejected hunk issues) of its original (by Colin Watson) from: https://git.savannah.gnu.org/cgit/man-db.git/patch/?id=b32977ff73220cd351387abe558fb523d1deedbb
|
||||
|
||||
Reported by Jiri Kucera.
|
||||
|
||||
* src/man.c (init_html_pager): New function.
|
||||
(parse_opt): Call init_html_pager rather than setting html_pager to
|
||||
NULL.
|
||||
(help_filter): Assert that browser is non-NULL.
|
||||
(main): Call init_html_pager rather than doing the same thing directly.
|
||||
* NEWS: Document this.
|
||||
---
|
||||
NEWS | 10 ++++++++++
|
||||
src/man.c | 17 +++++++++++------
|
||||
2 files changed, 21 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 366a0263..ff35e884 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -1,3 +1,13 @@
|
||||
+man-db 2.7.7
|
||||
+============
|
||||
+
|
||||
+Major changes since man-db 2.7.6.1:
|
||||
+
|
||||
+ Fixes:
|
||||
+ ------
|
||||
+
|
||||
+ o Fix a segfault in 'man -D --help'.
|
||||
+
|
||||
man-db 2.7.6.1 (12 December 2016)
|
||||
=================================
|
||||
|
||||
diff --git a/src/man.c b/src/man.c
|
||||
index 8b11f43e..cb0930b8 100644
|
||||
--- a/src/man.c
|
||||
+++ b/src/man.c
|
||||
@@ -345,6 +345,13 @@ static struct argp_option options[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
+static void init_html_pager (void)
|
||||
+{
|
||||
+ html_pager = getenv ("BROWSER");
|
||||
+ if (!html_pager)
|
||||
+ html_pager = WEB_BROWSER;
|
||||
+}
|
||||
+
|
||||
static error_t parse_opt (int key, char *arg, struct argp_state *state)
|
||||
{
|
||||
static int apropos, whatis; /* retain values between calls */
|
||||
@@ -369,7 +376,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
|
||||
ditroff = 0;
|
||||
gxditview = NULL;
|
||||
htmlout = 0;
|
||||
- html_pager = NULL;
|
||||
+ init_html_pager ();
|
||||
#endif
|
||||
roff_device = want_encoding = extension = pager =
|
||||
locale = alt_system_name = external =
|
||||
@@ -582,6 +589,7 @@ static char *help_filter (int key, const char *text,
|
||||
# ifdef TROFF_IS_GROFF
|
||||
case 'H':
|
||||
browser = html_pager;
|
||||
+ assert (browser);
|
||||
if (STRNEQ (browser, "exec ", 5))
|
||||
browser += 5;
|
||||
return xasprintf (text, browser);
|
||||
@@ -4018,11 +4026,8 @@ int main (int argc, char *argv[])
|
||||
|
||||
#ifdef TROFF_IS_GROFF
|
||||
/* used in --help, so initialise early */
|
||||
- if (!html_pager) {
|
||||
- html_pager = getenv ("BROWSER");
|
||||
- if (!html_pager)
|
||||
- html_pager = WEB_BROWSER;
|
||||
- }
|
||||
+ if (!html_pager)
|
||||
+ init_html_pager ();
|
||||
#endif /* TROFF_IS_GROFF */
|
||||
|
||||
/* First of all, find out if $MANOPT is set. If so, put it in
|
||||
--
|
||||
2.14.3
|
||||
|
@ -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,206 +0,0 @@
|
||||
From c73e7dd16b7915ac9c67a376e014ea1220095348 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 | 55 +++++++++++++++++++++---------------------------------
|
||||
2 files changed, 54 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/src/man.c b/src/man.c
|
||||
index 6d1cba7..b3d13d1 100644
|
||||
--- a/src/man.c
|
||||
+++ b/src/man.c
|
||||
@@ -2712,6 +2712,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)
|
||||
{
|
||||
@@ -2801,6 +2827,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 5441339..e437183 100644
|
||||
--- a/src/manp.c
|
||||
+++ b/src/manp.c
|
||||
@@ -903,23 +903,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
|
||||
@@ -968,7 +951,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);
|
||||
} GL_LIST_FOREACH_END (config);
|
||||
|
||||
@@ -989,11 +971,8 @@ char *get_manpath_from_path (const char *path, int mandatory)
|
||||
debug ("adding mandatory man directories\n");
|
||||
|
||||
GL_LIST_FOREACH_START (config, config_item) {
|
||||
- if (config_item->flag == MANDATORY) {
|
||||
- insert_override_dir (tmplist,
|
||||
- config_item->key);
|
||||
+ if (config_item->flag == MANDATORY)
|
||||
add_dir_to_list (tmplist, config_item->key);
|
||||
- }
|
||||
} GL_LIST_FOREACH_END (config);
|
||||
}
|
||||
|
||||
@@ -1078,7 +1057,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);
|
||||
@@ -1086,7 +1064,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);
|
||||
@@ -1095,7 +1072,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);
|
||||
@@ -1103,7 +1079,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);
|
||||
@@ -1199,7 +1174,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.
|
||||
*/
|
||||
@@ -1208,15 +1185,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.26.2
|
||||
|
@ -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
|
@ -1,58 +0,0 @@
|
||||
diff --git a/src/man.c b/src/man.c
|
||||
index b3d13d1..030a5d1 100644
|
||||
--- a/src/man.c
|
||||
+++ b/src/man.c
|
||||
@@ -991,11 +991,17 @@ static char *get_preprocessors_from_file (pipeline *decomp, int prefixes)
|
||||
|
||||
if (!strncmp (line, PP_COOKIE, 4)) {
|
||||
const char *newline = strchr (line, '\n');
|
||||
- if (newline)
|
||||
- return xstrndup (line + 4, newline - (line + 4));
|
||||
- else
|
||||
- return xstrdup (line + 4);
|
||||
+ if (newline) {
|
||||
+ char *ret = xstrndup (line + 4, newline - (line + 4));
|
||||
+ free (line);
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ char *ret = xstrdup (line + 4);
|
||||
+ free (line);
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
+ free (line);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2401,6 +2407,7 @@ static int display (const char *dir, const char *man_file,
|
||||
if (!found) {
|
||||
pipeline_free (format_cmd);
|
||||
pipeline_free (decomp);
|
||||
+ free (formatted_encoding);
|
||||
return found;
|
||||
}
|
||||
|
||||
diff --git a/src/zsoelim.c b/src/zsoelim.c
|
||||
index bf5c8ff..6a484c4 100644
|
||||
--- a/src/zsoelim.c
|
||||
+++ b/src/zsoelim.c
|
||||
@@ -2528,6 +2528,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
|
||||
if (decomp) {
|
||||
NAME = xstrdup (found_name);
|
||||
gl_list_free (names);
|
||||
+ free (name);
|
||||
goto out;
|
||||
}
|
||||
} GL_LIST_FOREACH_END (names);
|
||||
diff --git a/src/zsoelim.l b/src/zsoelim.l
|
||||
index a8a7e3b..3cb552b 100644
|
||||
--- a/src/zsoelim.l
|
||||
+++ b/src/zsoelim.l
|
||||
@@ -473,6 +473,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
|
||||
if (decomp) {
|
||||
NAME = xstrdup (found_name);
|
||||
gl_list_free (names);
|
||||
+ free (name);
|
||||
goto out;
|
||||
}
|
||||
} GL_LIST_FOREACH_END (names);
|
Loading…
Reference in new issue