From 2eca9ddb34658e24cdeed73f2b7a5d77372bb6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Thu, 9 Nov 2017 10:44:15 +0100 Subject: [PATCH 1/6] run cache update in a transient service using systemd-run - resolves #1318058 --- man-db-cache-update.service | 13 +++++++++++++ man-db.spec | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 man-db-cache-update.service diff --git a/man-db-cache-update.service b/man-db-cache-update.service new file mode 100644 index 0000000..2f2f0d5 --- /dev/null +++ b/man-db-cache-update.service @@ -0,0 +1,13 @@ +[Unit] +DefaultDependencies=no +After=local-fs.target +Before=reboot.target shutdown.target halt.target +JobTimeoutSec=15min + +[Service] +Type=oneshot +TimeoutStartSec=infinity +Environment=MAN_NO_LOCALE_WARNING=1 +ExecStart=/usr/bin/mandb +Nice=19 +IOWeight=20 diff --git a/man-db.spec b/man-db.spec index 0ff6e0e..14dfdd1 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 3%{?dist} +Release: 4%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -14,6 +14,7 @@ URL: http://www.nongnu.org/man-db/ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz Source1: man-db.crondaily Source2: man-db.sysconfig +Source3: man-db-cache-update.service 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 @@ -26,6 +27,9 @@ Provides: man-pages-reader = %{version} Provides: bundled(gnulib) = %{gnulib_ver} Requires: coreutils, grep, groff-base, gzip, less +# for file trigger scriptlets +Requires: systemd +BuildRequires: systemd BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel BuildRequires: po4a, perl, perl-version @@ -89,6 +93,9 @@ install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/man-db # config for tmpfiles.d install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/. +# man-db-cache-update.service +install -D -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/man-db-cache-update.service + %find_lang %{name} %find_lang %{name}-gnulib @@ -107,11 +114,12 @@ fi # update cache %transfiletriggerin -- %{_mandir} -MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q +/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update # update cache %transfiletriggerpostun -- %{_mandir} -MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q +/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update + %files -f %{name}.lang -f %{name}-gnulib.lang %{!?_licensedir:%global license %%doc} @@ -119,6 +127,7 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q %doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS %config(noreplace) %{_sysconfdir}/man_db.conf %config(noreplace) /usr/lib/tmpfiles.d/man-db.conf +%{_unitdir}/man-db-cache-update.service %{_sbindir}/accessdb %{_bindir}/man %{_bindir}/whatis @@ -163,6 +172,10 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q %config(noreplace) %{_sysconfdir}/sysconfig/man-db %changelog +* Wed Nov 08 2017 Nikola Forró - 2.7.6.1-4 +- run cache update in a transient service using systemd-run + resolves #1318058 + * Fri Feb 10 2017 Fedora Release Engineering - 2.7.6.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From 15260689d534a04960804e86504f275d9cdbc42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Thu, 16 Nov 2017 11:19:54 +0100 Subject: [PATCH 2/6] make file trigger scriptlets not to fail in case systemd is unavailable drop systemd dependency --- man-db.spec | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/man-db.spec b/man-db.spec index 14dfdd1..4f6594d 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 4%{?dist} +Release: 5%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -27,8 +27,6 @@ Provides: man-pages-reader = %{version} Provides: bundled(gnulib) = %{gnulib_ver} Requires: coreutils, grep, groff-base, gzip, less -# for file trigger scriptlets -Requires: systemd BuildRequires: systemd BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel BuildRequires: po4a, perl, perl-version @@ -114,11 +112,15 @@ fi # update cache %transfiletriggerin -- %{_mandir} -/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update +if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then + /usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update || : +fi # update cache %transfiletriggerpostun -- %{_mandir} -/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update +if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then + /usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update || : +fi %files -f %{name}.lang -f %{name}-gnulib.lang @@ -172,6 +174,10 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/man-db %changelog +* Thu Nov 16 2017 Nikola Forró - 2.7.6.1-5 +- make file trigger scriptlets not to fail in case systemd is unavailable +- drop systemd dependency + * Wed Nov 08 2017 Nikola Forró - 2.7.6.1-4 - run cache update in a transient service using systemd-run resolves #1318058 From 6722ef83e7b98fcd1d214a4c787bf3e4acd533bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 21 Nov 2017 17:55:57 +0100 Subject: [PATCH 3/6] set group of /var/cache/man to root and drop setgid bit - resolves: #1515823 --- man-db-2.7.6.1-change-owner-of-man-cache.patch | 2 +- man-db.spec | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/man-db-2.7.6.1-change-owner-of-man-cache.patch b/man-db-2.7.6.1-change-owner-of-man-cache.patch index eb2e0df..eec8069 100644 --- a/man-db-2.7.6.1-change-owner-of-man-cache.patch +++ b/man-db-2.7.6.1-change-owner-of-man-cache.patch @@ -13,7 +13,7 @@ index 1eb40ce..21936d5 100644 +++ b/init/systemd/man-db.conf @@ -1 +1 @@ -d /var/cache/man 0755 man man 1w -+d /var/cache/man 0755 root man 1w ++d /var/cache/man 0755 root root 1w -- 2.7.4 diff --git a/man-db.spec b/man-db.spec index 4f6594d..779e11e 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 5%{?dist} +Release: 6%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -57,7 +57,7 @@ This package provides periodic update of man-db cache. %build %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 --enable-cache-owner=root \ + --disable-setuid --disable-cache-owner \ --with-browser=elinks --with-lzip=lzip \ --with-override-dir=overrides make CC="%{__cc} %{optflags}" %{?_smp_mflags} V=1 @@ -144,7 +144,7 @@ fi %{_libexecdir}/man-db/globbing %{_libexecdir}/man-db/manconv %{_libexecdir}/man-db/zsoelim -%attr(2755,root,man) %verify(not mtime) %dir %{cache} +%verify(not mtime) %dir %{cache} # documentation and translation %{_mandir}/man1/apropos.1* %{_mandir}/man1/lexgrog.1* @@ -174,6 +174,10 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/man-db %changelog +* Tue Nov 21 2017 Nikola Forró - 2.7.6.1-6 +- set group of /var/cache/man to root and drop setgid bit + resolves: #1515823 + * Thu Nov 16 2017 Nikola Forró - 2.7.6.1-5 - make file trigger scriptlets not to fail in case systemd is unavailable - drop systemd dependency From d238b49d5fdf804b018b6c9c1e70f79d8d62d90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 21 Nov 2017 17:58:28 +0100 Subject: [PATCH 4/6] allow configuration of man-db-cache-update service through sysconfig - resolves: #1514909 --- man-db-cache-update.service | 3 ++- man-db.spec | 8 ++++++-- man-db.sysconfig | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/man-db-cache-update.service b/man-db-cache-update.service index 2f2f0d5..4ca914f 100644 --- a/man-db-cache-update.service +++ b/man-db-cache-update.service @@ -8,6 +8,7 @@ JobTimeoutSec=15min Type=oneshot TimeoutStartSec=infinity Environment=MAN_NO_LOCALE_WARNING=1 -ExecStart=/usr/bin/mandb +EnvironmentFile=/etc/sysconfig/man-db +ExecStart=/bin/sh -c '[ "$SERVICE" != "no" ] && /usr/bin/mandb $OPTS' Nice=19 IOWeight=20 diff --git a/man-db.spec b/man-db.spec index 779e11e..f089ae6 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 6%{?dist} +Release: 7%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -128,6 +128,7 @@ fi %license docs/COPYING %doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS %config(noreplace) %{_sysconfdir}/man_db.conf +%config(noreplace) %{_sysconfdir}/sysconfig/man-db %config(noreplace) /usr/lib/tmpfiles.d/man-db.conf %{_unitdir}/man-db-cache-update.service %{_sbindir}/accessdb @@ -171,9 +172,12 @@ fi %files cron %config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron -%config(noreplace) %{_sysconfdir}/sysconfig/man-db %changelog +* Tue Nov 21 2017 Nikola Forró - 2.7.6.1-7 +- allow configuration of man-db-cache-update service through sysconfig + resolves: #1514909 + * Tue Nov 21 2017 Nikola Forró - 2.7.6.1-6 - set group of /var/cache/man to root and drop setgid bit resolves: #1515823 diff --git a/man-db.sysconfig b/man-db.sysconfig index 608446d..e7449df 100644 --- a/man-db.sysconfig +++ b/man-db.sysconfig @@ -1,6 +1,10 @@ -# Set to no to disable daily man-db update by /etc/cron.daily/man-db.cron +# Set this to "no" to disable man-db update triggered by installation +# of any package containing manual pages +SERVICE="yes" + +# Set this to "no" to disable daily man-db update run by +# /etc/cron.daily/man-db.cron CRON="yes" -# Options used by mandb in /etc/cron.daily/man-db.cron, -# we use -q as default, too much noise without. +# Options used by mandb, we use "-q" as default, too much noise without it OPTS="-q" From 7bb3c7fad62c6c7b22071316a88303005dbf5214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 19 Dec 2017 17:31:32 +0100 Subject: [PATCH 5/6] fix failure of man-db-cache-update service when configured not to run - resolves: #1526715 --- man-db-cache-update.service | 2 +- man-db.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/man-db-cache-update.service b/man-db-cache-update.service index 4ca914f..dc218af 100644 --- a/man-db-cache-update.service +++ b/man-db-cache-update.service @@ -9,6 +9,6 @@ Type=oneshot TimeoutStartSec=infinity Environment=MAN_NO_LOCALE_WARNING=1 EnvironmentFile=/etc/sysconfig/man-db -ExecStart=/bin/sh -c '[ "$SERVICE" != "no" ] && /usr/bin/mandb $OPTS' +ExecStart=/bin/sh -c '[ "$SERVICE" != "no" ] && /usr/bin/mandb $OPTS || true' Nice=19 IOWeight=20 diff --git a/man-db.spec b/man-db.spec index f089ae6..4b27e66 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 7%{?dist} +Release: 8%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -174,6 +174,10 @@ fi %config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron %changelog +* Tue Dec 19 2017 Nikola Forró - 2.7.6.1-8 +- fix failure of man-db-cache-update service when configured not to run + resolves: #1526715 + * Tue Nov 21 2017 Nikola Forró - 2.7.6.1-7 - allow configuration of man-db-cache-update service through sysconfig resolves: #1514909 From 4f46ff3a0f23b00c26f6964a47379d2e95f852ac Mon Sep 17 00:00:00 2001 From: Jiri Kucera Date: Tue, 16 Jan 2018 17:24:38 +0100 Subject: [PATCH 6/6] 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 --- man-db-2.7.6.1-fix_rhbz1495507.patch | 90 ++++++++++++++++++++++++++++ man-db.spec | 11 +++- 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 man-db-2.7.6.1-fix_rhbz1495507.patch diff --git a/man-db-2.7.6.1-fix_rhbz1495507.patch b/man-db-2.7.6.1-fix_rhbz1495507.patch new file mode 100644 index 0000000..a3237f5 --- /dev/null +++ b/man-db-2.7.6.1-fix_rhbz1495507.patch @@ -0,0 +1,90 @@ +From 79308ac147be9e9c889798cba78bab2af05048e1 Mon Sep 17 00:00:00 2001 +From: Jiri Kucera +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 + diff --git a/man-db.spec b/man-db.spec index 4b27e66..a8dbd75 100644 --- a/man-db.spec +++ b/man-db.spec @@ -4,7 +4,7 @@ Summary: Tools for searching and reading man pages Name: man-db Version: 2.7.6.1 -Release: 8%{?dist} +Release: 9%{?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 - 2.7.6.1-9 +- fix segmentation fault caused by 'man -D?' + resolves: #1495507 + * Tue Dec 19 2017 Nikola Forró - 2.7.6.1-8 - fix failure of man-db-cache-update service when configured not to run resolves: #1526715 @@ -288,7 +295,7 @@ fi * Sun Oct 12 2014 jchaloup - 2.7.0.2-3 - remove executable flag for *.service and *.timer file - resolves: #1151558 + resolves: #1151558 * Wed Oct 08 2014 jchaloup - 2.7.0.2-2 - replacing cron with systemd.timer