Fix man killed by SIGSEGV if invoked as 'man -D?'
- resolves: #1495507 - related discussion: http://lists.nongnu.org/archive/html/man-db-devel/2018-01/msg00005.html - original patch: https://git.savannah.gnu.org/cgit/man-db.git/patch/?id=b32977ff73220cd351387abe558fb523d1deedbb
This commit is contained in:
parent
3b5e95b9d2
commit
b8aab2cabf
90
man-db-2.7.6.1-fix_rhbz1495507.patch
Normal file
90
man-db-2.7.6.1-fix_rhbz1495507.patch
Normal file
@ -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
|
||||
|
11
man-db.spec
11
man-db.spec
@ -4,7 +4,7 @@
|
||||
Summary: Tools for searching and reading man pages
|
||||
Name: man-db
|
||||
Version: 2.7.6.1
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
# GPLv2+ .. man-db
|
||||
# GPLv3+ .. gnulib
|
||||
License: GPLv2+ and GPLv3+
|
||||
@ -19,6 +19,9 @@ Patch0: man-db-2.7.6.1-change-owner-of-man-cache.patch
|
||||
|
||||
# http://lists.nongnu.org/archive/html/man-db-devel/2017-01/msg00013.html
|
||||
Patch1: man-db-2.7.6.1-fix-override-dir-handling.patch
|
||||
# http://lists.nongnu.org/archive/html/man-db-devel/2018-01/msg00005.html
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1495507
|
||||
Patch2: man-db-2.7.6.1-fix_rhbz1495507.patch
|
||||
|
||||
Obsoletes: man < 2.0
|
||||
Provides: man = %{version}
|
||||
@ -174,6 +177,10 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
|
||||
|
||||
%changelog
|
||||
* Tue Jan 16 2018 Jiri Kucera <jkucera@redhat.com> - 2.7.6.1-12
|
||||
- fix segmentation fault caused by 'man -D?'
|
||||
resolves: #1495507
|
||||
|
||||
* Tue Jan 16 2018 Nikola Forró <nforro@redhat.com> - 2.7.6.1-11
|
||||
- rebuild with gdbm-1.14
|
||||
|
||||
@ -297,7 +304,7 @@ fi
|
||||
|
||||
* Sun Oct 12 2014 jchaloup <jchaloup@redhat.com> - 2.7.0.2-3
|
||||
- remove executable flag for *.service and *.timer file
|
||||
resolves: #1151558
|
||||
resolves: #1151558
|
||||
|
||||
* Wed Oct 08 2014 jchaloup <jchaloup@redhat.com> - 2.7.0.2-2
|
||||
- replacing cron with systemd.timer
|
||||
|
Loading…
Reference in New Issue
Block a user