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-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-cache-update.service b/man-db-cache-update.service new file mode 100644 index 0000000..dc218af --- /dev/null +++ b/man-db-cache-update.service @@ -0,0 +1,14 @@ +[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 +EnvironmentFile=/etc/sysconfig/man-db +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 0ff6e0e..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: 3%{?dist} +Release: 9%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib License: GPLv2+ and GPLv3+ @@ -14,10 +14,14 @@ 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 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} @@ -26,6 +30,7 @@ Provides: man-pages-reader = %{version} Provides: bundled(gnulib) = %{gnulib_ver} Requires: coreutils, grep, groff-base, gzip, less +BuildRequires: systemd BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel BuildRequires: po4a, perl, perl-version @@ -55,7 +60,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 @@ -89,6 +94,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,18 +115,25 @@ fi # update cache %transfiletriggerin -- %{_mandir} -MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q +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} -MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q +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 %{!?_licensedir:%global license %%doc} %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 %{_bindir}/man %{_bindir}/whatis @@ -133,7 +148,7 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q %{_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* @@ -160,9 +175,32 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q %files cron %config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron -%config(noreplace) %{_sysconfdir}/sysconfig/man-db %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 + +* 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 + +* 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 + * Fri Feb 10 2017 Fedora Release Engineering - 2.7.6.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild @@ -257,7 +295,7 @@ MAN_NO_LOCALE_WARNING=1 /usr/bin/mandb -q * 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 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"