Accepting request 682844 from Base:System

- Ah ... yes, manual pages are also provides by e.g. mandoc

- Skip %verify(not link mtime) from symbolic links %_bindir even if
  those should not hurt but avoid superfluous verify messages

- Minor corrections on %ghost /var/cache/man and link to apropos 

- Use update-alternatives to allow that man(1), apropos(1), whatis(1)
  can be overwritten by an other package like mandoc
- Reintroduce wrapper for man(1) but without mapping to user man to
  be able to reset the PATH to the standard for any preprocessor

OBS-URL: https://build.opensuse.org/request/show/682844
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/man?expand=0&rev=73
This commit is contained in:
Dominique Leuenberger 2019-03-12 08:48:19 +00:00 committed by Git OBS Bridge
commit e705126134
3 changed files with 92 additions and 27 deletions

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Fri Mar 8 13:12:07 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Ah ... yes, manual pages are also provides by e.g. mandoc
-------------------------------------------------------------------
Thu Mar 7 07:59:37 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Skip %verify(not link mtime) from symbolic links %_bindir even if
those should not hurt but avoid superfluous verify messages
-------------------------------------------------------------------
Wed Mar 6 13:15:43 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Minor corrections on %ghost /var/cache/man and link to apropos
-------------------------------------------------------------------
Wed Mar 6 11:47:58 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Use update-alternatives to allow that man(1), apropos(1), whatis(1)
can be overwritten by an other package like mandoc
- Reintroduce wrapper for man(1) but without mapping to user man to
be able to reset the PATH to the standard for any preprocessor
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 26 11:37:32 UTC 2018 - Dr. Werner Fink <werner@suse.de> Mon Nov 26 11:37:32 UTC 2018 - Dr. Werner Fink <werner@suse.de>

View File

@ -1,7 +1,7 @@
# #
# spec file for package man # spec file for package man
# #
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -21,8 +21,6 @@
%define _fillupdir /var/adm/fillup-templates %define _fillupdir /var/adm/fillup-templates
%endif %endif
%bcond_with wrapman
Name: man Name: man
BuildRequires: automake BuildRequires: automake
BuildRequires: flex BuildRequires: flex
@ -37,6 +35,7 @@ BuildRequires: libzio-devel
BuildRequires: man-pages BuildRequires: man-pages
BuildRequires: pkg-config BuildRequires: pkg-config
BuildRequires: po4a BuildRequires: po4a
BuildRequires: update-alternatives
BuildRequires: xz-devel BuildRequires: xz-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
Version: 2.8.4 Version: 2.8.4
@ -58,6 +57,8 @@ Requires: groff >= 1.18
Requires: less Requires: less
Requires(pre): user(man) Requires(pre): user(man)
Requires(pre): group(man) Requires(pre): group(man)
Requires(post): update-alternatives
Requires(preun): update-alternatives
Source: http://download.savannah.gnu.org/releases/man-db/man-db-%{version}.tar.xz Source: http://download.savannah.gnu.org/releases/man-db/man-db-%{version}.tar.xz
Source1: sysconfig.cron-man Source1: sysconfig.cron-man
Source2: cron.daily.do_mandb Source2: cron.daily.do_mandb
@ -204,29 +205,39 @@ fi
mkdir -p %{buildroot}%{_libexecdir}/man-db mkdir -p %{buildroot}%{_libexecdir}/man-db
mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}/etc mkdir -p %{buildroot}/etc
mkdir -p %{buildroot}%{_mandir}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
make nls=all install DESTDIR=%{buildroot} make nls=all install DESTDIR=%{buildroot}
rm -vf %{buildroot}%{_libdir}/*.la rm -vf %{buildroot}%{_libdir}/*.la
mv %{buildroot}%{_datadir}/doc/man-db/man-db-manual.* \ mv %{buildroot}%{_datadir}/doc/man-db/man-db-manual.* \
%{buildroot}%{_datadir}/doc/packages/man/ %{buildroot}%{_datadir}/doc/packages/man/
# wrapper which drops roots privileges if root executes man or mandb # wrapper which drops roots privileges if root executes man or mandb
if test -x %{buildroot}%{_bindir}/mandb ; then mv -vf %{buildroot}%{_bindir}/man %{buildroot}%{_libexecdir}/man-db/
mv %{buildroot}%{_bindir}/mandb %{buildroot}%{_libexecdir}/man-db/ mv -vf %{buildroot}%{_bindir}/mandb %{buildroot}%{_libexecdir}/man-db/
install wrapper %{buildroot}%{_bindir}/mandb rm -vf %{buildroot}%{_bindir}/apropos
fi mv -vf %{buildroot}%{_bindir}/whatis %{buildroot}%{_libexecdir}/man-db/
%if %{with wrapman} install wrapper %{buildroot}%{_libexecdir}/man-db/
if test -x %{buildroot}%{_bindir}/man ; then ln -sf %{_libexecdir}/man-db/wrapper %{buildroot}%{_sysconfdir}/alternatives/man
mv %{buildroot}%{_bindir}/man %{buildroot}%{_libexecdir}/man-db/ ln -sf %{_libexecdir}/man-db/wrapper %{buildroot}%{_bindir}/mandb
ln -sf mandb %{buildroot}%{_bindir}/man ln -sf %{_libexecdir}/man-db/whatis %{buildroot}%{_sysconfdir}/alternatives/apropos
fi ln -sf %{_libexecdir}/man-db/whatis %{buildroot}%{_sysconfdir}/alternatives/whatis
%endif ln -sf %{_sysconfdir}/alternatives/man %{buildroot}%{_bindir}/man
mkdir -p %{buildroot}%{_mandir} ln -sf %{_sysconfdir}/alternatives/apropos %{buildroot}%{_bindir}/apropos
ln -sf %{_sysconfdir}/alternatives/whatis %{buildroot}%{_bindir}/whatis
pushd %{buildroot}%{_mandir}/ pushd %{buildroot}%{_mandir}/
rm -rf *.ascii/ rm -rf *.ascii/
for d in *.UTF-8 ; do for d in *.UTF-8 ; do
find -name '*.[1-9nlop]' | xargs gzip -9f find -name '*.[1-9nlop]' | xargs gzip -9f
done done
for d in `find -name manpath.5.gz -printf '%%h '` ; do for d in `find -name manpath.5%{?ext_man} -printf '%%h '` ; do
ln -sf manpath.5.gz $d/manpath.config.5.gz ln -sf manpath.5%{?ext_man} $d/manpath.config.5%{?ext_man}
done
for man in apropos man whatis
do
mv man1/${man}.1%{?ext_man} man1/${man}-db.1%{?ext_man}
ln -sf %{_sysconfdir}/alternatives/${man}.1%{?ext_man} man1/${man}.1%{?ext_man}
ln -sf %{_mandir}/man1/${man}-db.1%{?ext_man} %{buildroot}%{_sysconfdir}/alternatives/${man}.1%{?ext_man}
done done
# remove japanese pages, as they are in man-pages-ja # remove japanese pages, as they are in man-pages-ja
@ -274,12 +285,25 @@ test -d var/catman/ && rm -rf var/catman/ || true
%if 0%{suse_version} >= 1500 %if 0%{suse_version} >= 1500
%service_add_post mandb.service mandb.timer %service_add_post mandb.service mandb.timer
%endif %endif
# Remark: soelim(1) is part of package groff or mandoc and
# makewhatis(8) is part of package makewaht or mandoc
%{_sbindir}/update-alternatives --quiet --force \
--install %{_bindir}/man man %{_libexecdir}/man-db/wrapper 1010 \
--slave %{_bindir}/apropos apropos %{_libexecdir}/man-db/whatis \
--slave %{_bindir}/whatis whatis %{_libexecdir}/man-db/whatis \
--slave %{_mandir}/man1/man.1%{?ext_man} man.1%{?ext_man} %{_mandir}/man1/man-db.1%{?ext_man} \
--slave %{_mandir}/man1/apropos.1%{?ext_man} apropos.1%{?ext_man} %{_mandir}/man1/apropos-db.1%{?ext_man} \
--slave %{_mandir}/man1/whatis.1%{?ext_man} whatis.1%{?ext_man} %{_mandir}/man1/whatis-db.1%{?ext_man}
%preun %preun
%service_del_preun man-db-create.service %service_del_preun man-db-create.service
%if 0%{suse_version} >= 1500 %if 0%{suse_version} >= 1500
%service_del_preun mandb.service mandb.timer %service_del_preun mandb.service mandb.timer
%endif %endif
if test $1 -eq 0
then
%{_sbindir}/update-alternatives --quiet --remove man %{_bindir}/man
fi
%postun %postun
/sbin/ldconfig /sbin/ldconfig
@ -300,20 +324,26 @@ test -d /var/cache/man && mandb --quiet --create ||:
%if 0%{suse_version} < 1500 %if 0%{suse_version} < 1500
%attr(0744,root,root) /etc/cron.daily/suse-do_mandb %attr(0744,root,root) /etc/cron.daily/suse-do_mandb
%endif %endif
%ghost %config %{_sysconfdir}/alternatives/man
%ghost %config %{_sysconfdir}/alternatives/apropos
%ghost %config %{_sysconfdir}/alternatives/whatis
%ghost %config %{_sysconfdir}/alternatives/man.1%{ext_man}
%ghost %config %{_sysconfdir}/alternatives/apropos.1%{ext_man}
%ghost %config %{_sysconfdir}/alternatives/whatis.1%{ext_man}
%{_bindir}/man
%{_bindir}/apropos %{_bindir}/apropos
%{_bindir}/whatis
%{_bindir}/mandb
%{_bindir}/catman %{_bindir}/catman
%{_bindir}/lexgrog %{_bindir}/lexgrog
%{_bindir}/man
%{_bindir}/mandb
%{_bindir}/manpath %{_bindir}/manpath
%{_bindir}/whatis
%dir %attr(0755,root,root) %{_libexecdir}/man-db %dir %attr(0755,root,root) %{_libexecdir}/man-db
%if %{with wrapman}
%attr(0755,root,root) %{_libexecdir}/man-db/man %attr(0755,root,root) %{_libexecdir}/man-db/man
%endif %attr(0755,root,root) %{_libexecdir}/man-db/whatis
%attr(0755,root,root) %{_libexecdir}/man-db/mandb %attr(0755,root,root) %{_libexecdir}/man-db/mandb
%attr(0755,man,man) %{_libexecdir}/man-db/manconv %attr(0755,man,man) %{_libexecdir}/man-db/manconv
%attr(0755,man,man) %{_libexecdir}/man-db/globbing %attr(0755,man,man) %{_libexecdir}/man-db/globbing
%attr(0755,root,root) %{_libexecdir}/man-db/wrapper
%if 0%{suse_version} >= 1500 %if 0%{suse_version} >= 1500
%attr(0744,man,man) %{_libexecdir}/man-db/do_mandb %attr(0744,man,man) %{_libexecdir}/man-db/do_mandb
%endif %endif
@ -332,14 +362,14 @@ test -d /var/cache/man && mandb --quiet --create ||:
%dir %{_datadir}/groff/site-tmac %dir %{_datadir}/groff/site-tmac
%{_datadir}/groff/site-tmac/tmac.andb %{_datadir}/groff/site-tmac/tmac.andb
%{_datadir}/groff/site-tmac/tmac.andocdb %{_datadir}/groff/site-tmac/tmac.andocdb
%doc %{_mandir}/man1/*.1.gz %doc %{_mandir}/man1/*.1%{?ext_man}
%doc %{_mandir}/man5/*.5.gz %doc %{_mandir}/man5/*.5%{?ext_man}
%doc %{_mandir}/man8/*.8.gz %doc %{_mandir}/man8/*.8%{?ext_man}
%dir %{_mandir}/id %dir %{_mandir}/id
%dir %{_mandir}/sr %dir %{_mandir}/sr
%dir %{_mandir}/tr %dir %{_mandir}/tr
%{_fillupdir}/sysconfig.cron-man %{_fillupdir}/sysconfig.cron-man
%defattr(-,man,man) %defattr(-,man,man)
%ghost %{_localstatedir}/cache/man %ghost %verify(not group) %{_localstatedir}/cache/man
%changelog %changelog

View File

@ -67,6 +67,7 @@ char *program_name;
int main (int argc, char **argv, char *envp[]) int main (int argc, char **argv, char *envp[])
{ {
extern char **environ;
uid_t ruid, euid; uid_t ruid, euid;
gid_t rgid; gid_t rgid;
@ -87,6 +88,11 @@ int main (int argc, char **argv, char *envp[])
euid = geteuid(); euid = geteuid();
rgid = getgid (); rgid = getgid ();
/* The various preprocessors should be in standard path */
environ = envp;
setenv("PATH", "/bin:/usr/bin", 1);
envp = environ;
#ifdef DEBUG #ifdef DEBUG
printf ("%s:\n", program_name); printf ("%s:\n", program_name);
#endif #endif
@ -101,6 +107,10 @@ int main (int argc, char **argv, char *envp[])
#ifdef DEBUG #ifdef DEBUG
printf ("%s\n", wlp->run); printf ("%s\n", wlp->run);
#endif #endif
if (strcmp("man", wlp->prog) == 0)
/* Short cut: do not map man command to an other user */
goto man;
if (ruid == 0 || euid == 0) { if (ruid == 0 || euid == 0) {
static char *dummy_environ[] = { NULL }; static char *dummy_environ[] = { NULL };
extern char **environ; extern char **environ;
@ -152,9 +162,10 @@ int main (int argc, char **argv, char *envp[])
setenv("USER", pwd->pw_name, 1); setenv("USER", pwd->pw_name, 1);
setenv("LOGNAME", pwd->pw_name, 1); setenv("LOGNAME", pwd->pw_name, 1);
if (cwd) if (cwd)
setenv("TERM", cwd, 1); setenv("PWD", cwd, 1);
envp = environ; envp = environ;
} }
man:
execve (wlp->run, argv, envp); execve (wlp->run, argv, envp);
perror ("execve"); perror ("execve");
return -errno; return -errno;