Compare commits

...

No commits in common. "c8s" and "c9-beta" have entirely different histories.
c8s ... c9-beta

49 changed files with 508 additions and 4294 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
/man-db-2.7.5.tar.xz
/man-db-2.7.6.1.tar.xz
SOURCES/man-db-2.9.3.tar.xz

1
.man-db.metadata Normal file
View File

@ -0,0 +1 @@
76ec7a9f5222fbd6fc5364929270a4790094a617 SOURCES/man-db-2.9.3.tar.xz

View File

@ -0,0 +1,19 @@
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

View File

@ -0,0 +1,206 @@
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

View File

@ -0,0 +1,13 @@
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

View File

@ -0,0 +1,58 @@
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);

View File

@ -3,12 +3,11 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.7.6.1
Release: 18%{?dist}
Version: 2.9.3
Release: 7%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
Group: System Environment/Base
URL: http://www.nongnu.org/man-db/
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
@ -16,15 +15,17 @@ Source1: man-db.crondaily
Source2: man-db.sysconfig
Source3: man-db-cache-update.service
Source4: man-db-restart-cache-update.service
Patch0: man-db-2.7.6.1-change-owner-of-man-cache.patch
Patch0: man-db-2.8.3-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
Patch1: man-db-2.8.7-fix-override-dir-handling.patch
Patch3: man-db-2.7.6.1-coverity.patch
# change snap system directory from /snap to /var/lib/snapd/snap
# https://lists.gnu.org/archive/html/man-db-devel/2020-02/msg00000.html
Patch2: man-db-2.9.1-snap.patch
# fix important Covscan defects
Patch3: man-db-2.9.3-coverity.patch
Obsoletes: man < 2.0
Provides: man = %{version}
@ -33,10 +34,16 @@ Provides: man-pages-reader = %{version}
Provides: bundled(gnulib) = %{gnulib_ver}
Requires: coreutils, grep, groff-base, gzip, less
BuildRequires: make
BuildRequires: gcc
BuildRequires: systemd
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
BuildRequires: po4a, perl-interpreter, perl-version
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
%description
The man-db package includes five tools for browsing man-pages:
man, whatis, apropos, manpath and lexgrog. man formats and displays
@ -47,7 +54,6 @@ manual pages.
%package cron
Summary: Periodic update of man-db cache
Group: System Environment/Base
Requires: %{name} = %{version}-%{release}
Requires: crontabs
@ -62,24 +68,30 @@ 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" \
--with-sections="1 1p 8 2 3 3p 3pm 4 5 6 7 9 0p n l p o 1x 2x 3x 4x 5x 6x 7x 8x" \
--disable-setuid --disable-cache-owner \
--with-systemdsystemunitdir=no \
--with-browser=elinks --with-lzip=lzip \
--with-override-dir=overrides
make CC="%{__cc} %{optflags}" %{?_smp_mflags} V=1
%make_build CC="%{__cc} %{optflags}"
%check
make check
%install
make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} INSTALL='install -p'
%make_install prefix=%{_prefix}
# rename files for alternative usage
for f in man apropos whatis; do
mv %{buildroot}%{_bindir}/$f %{buildroot}%{_bindir}/$f.%{name}
touch %{buildroot}%{_bindir}/$f
mv %{buildroot}%{_mandir}/man1/$f.1 %{buildroot}%{_mandir}/man1/$f.%{name}.1
touch %{buildroot}%{_mandir}/man1/$f.1
done
# move the documentation to the relevant place
mv $RPM_BUILD_ROOT%{_datadir}/doc/man-db/* ./
# remove creation timestamp to avoid multilib difference
sed -i '/^%%%%CreationDate:.*$/d' man-db-manual.ps
# remove zsoelim man page - part of groff package
rm $RPM_BUILD_ROOT%{_datadir}/man/man1/zsoelim.1
@ -107,31 +119,57 @@ install -D -p -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/man-db-restart-cache
%find_lang %{name}
%find_lang %{name}-gnulib
# stop and disable timer from previous builds
%pre
# remove alternativized files if they are not symlinks
for f in man apropos whatis; do
[ -L %{_bindir}/$f ] || %{__rm} -f %{_bindir}/$f >/dev/null 2>&1 || :
[ -L %{_mandir}/man1/$f.1.gz ] || %{__rm} -f %{_mandir}/man1/$f.1.gz >/dev/null 2>&1 || :
done
# stop and disable timer from previous builds
if [ -e /usr/lib/systemd/system/mandb.timer ]; then
if test -d /run/systemd; then
systemctl stop man-db.timer
systemctl -q disable man-db.timer
fi
if test -d /run/systemd; then
systemctl stop man-db.timer >/dev/null 2>&1 || :
systemctl -q disable man-db.timer >/dev/null 2>&1 || :
fi
fi
%post
# set up the alternatives files
%{_sbindir}/update-alternatives --install %{_bindir}/man man %{_bindir}/man.%{name} 300 \
--slave %{_bindir}/apropos apropos %{_bindir}/apropos.%{name} \
--slave %{_bindir}/whatis whatis %{_bindir}/whatis.%{name} \
--slave %{_mandir}/man1/man.1.gz man.1.gz %{_mandir}/man1/man.%{name}.1.gz \
--slave %{_mandir}/man1/apropos.1.gz apropos.1.gz %{_mandir}/man1/apropos.%{name}.1.gz \
--slave %{_mandir}/man1/whatis.1.gz whatis.1.gz %{_mandir}/man1/whatis.%{name}.1.gz \
>/dev/null 2>&1 || :
# clear the old cache
%post
%{__rm} -rf %{cache}/*
%{__rm} -rf %{cache}/* >/dev/null 2>&1 || :
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
%postun
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/man)" == "%{_bindir}/man.%{name}" ]; then
%{_sbindir}/update-alternatives --set man %{_bindir}/man.%{name} >/dev/null 2>&1 || :
fi
fi
# update cache
%transfiletriggerin -- %{_mandir}
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
# update cache
%transfiletriggerpostun -- %{_mandir}
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
%transfiletriggerpostun -- %{_mandir}
# update cache
if [ -x /usr/bin/systemd-run -a -x /usr/bin/systemctl ]; then
/usr/bin/systemd-run /usr/bin/systemctl start man-db-cache-update >/dev/null 2>&1 || :
fi
%files -f %{name}.lang -f %{name}-gnulib.lang
%{!?_licensedir:%global license %%doc}
@ -143,9 +181,13 @@ fi
%{_unitdir}/man-db-cache-update.service
%{_unitdir}/man-db-restart-cache-update.service
%{_sbindir}/accessdb
%{_bindir}/man
%{_bindir}/whatis
%{_bindir}/apropos
%ghost %{_bindir}/man
%ghost %{_bindir}/apropos
%ghost %{_bindir}/whatis
%{_bindir}/man.%{name}
%{_bindir}/apropos.%{name}
%{_bindir}/whatis.%{name}
%{_bindir}/man-recode
%{_bindir}/manpath
%{_bindir}/lexgrog
%{_bindir}/catman
@ -158,52 +200,161 @@ fi
%{_libexecdir}/man-db/zsoelim
%verify(not mtime) %dir %{cache}
# documentation and translation
%{_mandir}/man1/apropos.1*
%ghost %{_mandir}/man1/man.1*
%ghost %{_mandir}/man1/apropos.1*
%ghost %{_mandir}/man1/whatis.1*
%{_mandir}/man1/man.%{name}.1*
%{_mandir}/man1/apropos.%{name}.1*
%{_mandir}/man1/whatis.%{name}.1*
%{_mandir}/man1/man-recode.1*
%{_mandir}/man1/lexgrog.1*
%{_mandir}/man1/man.1*
%{_mandir}/man1/manconv.1*
%{_mandir}/man1/manpath.1*
%{_mandir}/man1/whatis.1*
%{_mandir}/man5/manpath.5*
%{_mandir}/man8/accessdb.8*
%{_mandir}/man8/catman.8*
%{_mandir}/man8/mandb.8*
%lang(da) %{_datadir}/man/da/man*/*
%lang(de) %{_datadir}/man/de/man*/*
%lang(es) %{_datadir}/man/es/man*/*
%lang(fr) %{_datadir}/man/fr/man*/*
%lang(id) %{_datadir}/man/id/man*/*
%lang(it) %{_datadir}/man/it/man*/*
%lang(ja) %{_datadir}/man/ja/man*/*
%lang(nl) %{_datadir}/man/nl/man*/*
%lang(pl) %{_datadir}/man/pl/man*/*
%lang(ru) %{_datadir}/man/ru/man*/*
%lang(sv) %{_datadir}/man/sv/man*/*
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%lang(da) %{_datadir}/man/da/man*/*
%lang(de) %{_datadir}/man/de/man*/*
%lang(es) %{_datadir}/man/es/man*/*
%lang(fr) %{_datadir}/man/fr/man*/*
%lang(id) %{_datadir}/man/id/man*/*
%lang(it) %{_datadir}/man/it/man*/*
%lang(ja) %{_datadir}/man/ja/man*/*
%lang(nl) %{_datadir}/man/nl/man*/*
%lang(pl) %{_datadir}/man/pl/man*/*
%lang(pt) %{_datadir}/man/pt/man*/*
%lang(pt_BR) %{_datadir}/man/pt_BR/man*/*
%lang(ru) %{_datadir}/man/ru/man*/*
%lang(sr) %{_datadir}/man/sr/man*/*
%lang(sv) %{_datadir}/man/sv/man*/*
%lang(tr) %{_datadir}/man/tr/man*/*
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%files cron
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
%changelog
* Thu Jun 24 2021 Nikola Forró <nforro@redhat.com> - 2.7.6.1-18
* Mon Sep 19 2022 Lukas Javorsky <ljavorsk@redhat.com> - 2.9.3-7
- Rebuild for man-db-cron compose change.
Changing from buildroot to Appstream compose.
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.9.3-6
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Jul 30 2021 Nikola Forró <nforro@redhat.com> - 2.9.3-5
- fix important Covscan defects
resolves #1938814
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.9.3-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Oct 09 2020 Jeff Law <law@redhat.com> - 2.9.3-2
- Re-enable LTO
* Tue Oct 06 2020 Nikola Forró <nforro@redhat.com> - 2.9.3-1
- update to 2.9.3
resolves #1849809
* Thu Sep 03 2020 Nikola Forró <nforro@redhat.com> - 2.9.2-6
- disable LTO to workaround a possible linker bug
related to #1871971
* Tue Aug 04 2020 Nikola Forró <nforro@redhat.com> - 2.9.2-5
- reenable LTO
* Tue Jul 28 2020 Nikola Forró <nforro@redhat.com> - 2.9.2-4
- disable LTO to avoid linker bug
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 2.9.2-2
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jun 02 2020 Nikola Forró <nforro@redhat.com> - 2.9.2-1
- update to 2.9.2
resolves #1842624
* Sun Mar 01 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-6
- fix %pre scriptlet
* Fri Feb 28 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-5
- fix upgrades from non-alternativized versions properly
* Fri Feb 28 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-4
- fix upgrades from non-alternativized versions
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-3
- fix %postun scriptlet
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-2
- use alternatives for man, apropos and whatis
* Wed Feb 26 2020 Nikola Forró <nforro@redhat.com> - 2.9.1-1
- update to 2.9.1
resolves #1807144
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jan 09 2020 Nikola Forró <nforro@redhat.com> - 2.9.0-1
- update to 2.9.0
resolves #1764582
* Fri Sep 27 2019 Nikola Forró <nforro@redhat.com> - 2.8.7-2
- schedule interrupted cache update for the next boot, instead of blocking
system reboot/shutdown
resolves #1874010
resolves #1678464
* Wed Nov 07 2018 Nikola Forró <nforro@redhat.com> - 2.7.6.1-17
- avoid multilib difference in man-db-manual.ps
* Fri Aug 30 2019 Nikola Forró <nforro@redhat.com> - 2.8.7-1
- update to 2.8.7
resolves #1747042
* Tue Aug 27 2019 Nikola Forró <nforro@redhat.com> - 2.8.6.1-1
- update to 2.8.6.1
resolves #1742475
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 07 2019 Nikola Forró <nforro@redhat.com> - 2.8.4-3
- prioritize POSIX man pages over perl manuals
resolves #1663919
* Wed Nov 07 2018 Nikola Forró <nforro@redhat.com> - 2.8.4-2
- get rid of hardcoded path
related: #1607005
* Wed Oct 17 2018 Nikola Forró <nforro@redhat.com> - 2.7.6.1-16
- fix important Covscan defects
resolves: #1607005
* Mon Jul 30 2018 Nikola Forró <nforro@redhat.com> - 2.8.4-1
- update to 2.8.4
resolves #1609438
* Mon Jul 30 2018 Florian Weimer <fweimer@redhat.com> - 2.7.6.1-15
- Rebuild with fixed binutils
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jul 25 2018 Petr Kubat <pkubat@redhat.com> - 2.7.6.1-14
- Rebuilt for gdbm
* Thu Jul 12 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.8.3-3
- Rebuild for new gdbm
* Fri Apr 06 2018 Nikola Forró <nforro@redhat.com> - 2.8.3-2
- fix version in the name of change-owner-of-man-cache patch
* Fri Apr 06 2018 Nikola Forró <nforro@redhat.com> - 2.8.3-1
- update to 2.8.3
resolves #1564220
* Tue Feb 20 2018 Nikola Forró <nforro@redhat.com> - 2.7.6.1-15
- add missing gcc build dependency
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.6.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sat Feb 03 2018 Todd Zullinger <tmz@pobox.com> - 2.7.6.1-13
- Avoid noisy output from man-db-cache-update triggers

View File

@ -1,6 +0,0 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,19 +0,0 @@
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

View File

@ -1,188 +0,0 @@
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);

View File

@ -1,177 +0,0 @@
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

View File

@ -1,90 +0,0 @@
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

View File

@ -1 +0,0 @@
SHA512 (man-db-2.7.6.1.tar.xz) = 623c5e7f8b7c289908b2c926f8777293b8d39aeceef0d2509d701a8b0bfa81408650f655c8608318221786c751a79ee91124b07993de5298cd7fa6d8bb737301

View File

@ -1,40 +0,0 @@
SH ?= sh
TESTS = \
lexgrog-1 \
man-1 \
man-2 \
man-3 \
man-4 \
man-5 \
man-6 \
man-7 \
man-8 \
man-9 \
man-10 \
man-11 \
manconv-1 \
manconv-2 \
manconv-3 \
mandb-1 \
mandb-2 \
mandb-3 \
mandb-4 \
mandb-5 \
mandb-6 \
mandb-7 \
whatis-1 \
zsoelim-1
export DBTYPE = gdbm
export MANCONV = /usr/libexec/man-db/manconv
.PHONY: test $(TESTS)
test: $(TESTS)
fspause: fspause.c
$(CC) $(CFLAGS) -o $@ $<
$(TESTS): %: fspause
$(SH) $@

View File

@ -1,51 +0,0 @@
## Process this file with automake to produce Makefile.in
##
## Copyright (C) 2009, 2010, 2011 Colin Watson.
##
## This file is part of man-db.
##
## man-db is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## man-db is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with man-db; if not, write to the Free Software Foundation,
## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
TESTS_ENVIRONMENT = PATH=$(abs_builddir)/..:$$PATH; export PATH; \
DBTYPE=$(DBTYPE); export DBTYPE; \
MANDIR_LAYOUT=$(MANDIR_LAYOUT); export MANDIR_LAYOUT; \
abs_top_builddir=$(abs_top_builddir); export abs_top_builddir; \
@LOCALCHARSET_TESTS_ENVIRONMENT@; export CHARSETALIASDIR; \
OVERRIDE_DIR="$(override_dir)"; export OVERRIDE_DIR;
# Each test must use the configure-detected shell, not necessarily /bin/sh.
AM_LOG_FLAGS = $(SHELL)
ALL_TESTS = \
lexgrog-1 \
man-1 man-2 man-3 man-4 man-5 man-6 man-7 man-8 man-9 man-10 man-11 \
manconv-1 manconv-2 manconv-3 \
mandb-1 mandb-2 mandb-3 mandb-4 mandb-5 mandb-6 mandb-7 \
whatis-1 \
zsoelim-1
if !CROSS_COMPILING
TESTS = $(ALL_TESTS)
endif
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/gnulib/lib
AM_CFLAGS = $(WARN_CFLAGS)
check_PROGRAMS = fspause
fspause_SOURCES = fspause.c
fspause_LDADD = \
$(top_builddir)/gnulib/lib/libgnu.la \
$(LIB_NANOSLEEP)
dist_check_SCRIPTS = testlib.sh $(ALL_TESTS)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
man-db test suite modified to run against installed man-db
All files except the following are taken unmodified from upstream tarball:
Makefile
fspause.c
testlib.sh

View File

@ -1,133 +0,0 @@
/*
* fspause.c: pause until a file timestamp updates
*
* Copyright (C) 2014 Colin Watson.
*
* This file is part of man-db.
*
* man-db is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* man-db is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with man-db; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
static char *filename;
static int fd = -1;
#define MUST(name, cond) \
do { \
if (!(cond)) { \
fprintf (stderr, "fspause: " name " failed\n"); \
abort (); \
} \
} while (0)
struct timespec get_stat_mtime (struct stat const *st)
{
return st->st_mtim;
}
int timespec_cmp (struct timespec a, struct timespec b)
{
if (a.tv_sec < b.tv_sec)
return -1;
if (a.tv_sec > b.tv_sec)
return 1;
return a.tv_nsec - b.tv_nsec;
}
char *xstrdup (char const *string)
{
size_t n = strlen (string) + 1;
void *p = malloc (n);
if (!p && n != 0) {
fprintf (stderr, "fspause: memory exhausted\n");
abort ();
}
return memcpy (p, string, n);
}
static void unlink_tempfile (void)
{
if (fd >= 0) {
MUST ("close", close (fd) >= 0);
MUST ("unlink", unlink (filename) >= 0);
}
}
static void delay (int delay_ns)
{
struct timespec delay_ts;
delay_ts.tv_sec = delay_ns / 1000000000;
delay_ts.tv_nsec = delay_ns % 1000000000;
for (;;) {
errno = 0;
if (nanosleep (&delay_ts, NULL) == 0)
break;
MUST ("nanosleep", errno == 0 || errno == EINTR);
}
}
static int try_delay (struct stat *st, int delay_ns)
{
struct timespec start_ts, end_ts;
start_ts = get_stat_mtime (st);
delay (delay_ns);
MUST ("write", write (fd, "\n", 1) == 1);
MUST ("fstat", fstat (fd, st) >= 0);
end_ts = get_stat_mtime (st);
return timespec_cmp (start_ts, end_ts) != 0;
}
int main (int argc, char **argv)
{
struct stat st;
int delay_ns;
filename = xstrdup ("fspause.tmp.XXXXXX");
MUST ("mkstemp", (fd = mkstemp (filename)) >= 0);
atexit (unlink_tempfile);
MUST ("fstat", fstat (fd, &st) >= 0);
/* 0x40000000 nanoseconds is just over a second. The effective
* maximum delay we will allow is thus about two seconds. This
* saves us having to keep track of anything more complicated than a
* single signed 32-bit int.
*/
for (delay_ns = 1; delay_ns < 0x40000000; delay_ns *= 2) {
if (try_delay (&st, delay_ns))
return 0;
}
fprintf (stderr,
"fspause: temporary file timestamp refuses to change!\n");
return 1;
}

View File

@ -1,18 +0,0 @@
#! /bin/sh
# Basic lexgrog tests.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${LEXGROG=lexgrog}
init
write_page lextest 1 "$tmpdir/usr/share/man/man1/lextest.1.gz" UTF-8 gz '' \
'lextest \- simple lexgrog test'
echo "$tmpdir/usr/share/man/man1/lextest.1.gz: \"lextest - simple lexgrog test\"" >"$tmpdir/1.exp"
run $LEXGROG "$tmpdir/usr/share/man/man1/lextest.1.gz" >"$tmpdir/1.out"
expect_pass 'simple lexgrog test' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,31 +0,0 @@
#! /bin/sh
# Test for:
# http://bugs.debian.org/163347
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/local/man /usr/share/man
MANPATH="$tmpdir/usr/local/man:$tmpdir/usr/share/man"
export MANPATH
write_page md5sum 1 "$tmpdir/usr/share/man/man1/md5sum.1.gz" \
UTF-8 gz '' 'md5sum \- Debian md5sum manual page'
write_page md5sum 1 "$tmpdir/usr/share/man/man1/md5sum.textutils.1.gz" \
UTF-8 gz '' 'md5sum \- coreutils md5sum manual page'
mkdir -p "$tmpdir/usr/local/man/man1"
ln -s ../../../share/man/man1/md5sum.textutils.1.gz \
"$tmpdir/usr/local/man/man1/md5sum.1.gz"
cat >"$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/md5sum.textutils.1.gz
$abstmpdir/usr/share/man/man1/md5sum.1.gz
EOF
run $MAN -C "$tmpdir/manpath.config" -aw md5sum >"$tmpdir/1.out"
expect_pass 'symlinks with matching names win' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,26 +0,0 @@
#! /bin/sh
# Test that man can run from a deleted directory.
# https://bugs.debian.org/764384
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
echo "MANDATORY_MANPATH $abstmpdir/usr/share/man" >"$tmpdir/manpath.config"
MANPATH="$abstmpdir/usr/share/man"
export MANPATH
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- test'
mkdir "$tmpdir/zombie"
cd "$tmpdir/zombie"
rmdir "$abstmpdir/zombie" || \
skip "can't remove current working directory on this system"
run $MAN -C "$abstmpdir/manpath.config" test >/dev/null
code=$?
expect_pass 'run from deleted directory' 'test "$code" = 0'
finish

View File

@ -1,45 +0,0 @@
#!/bin/sh
# Test for:
# man chmod.2 => man 2 chmod
# man chmod.2p => man 2p chmod
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
page_name="chmod"
write_page "$page_name" 1 "$tmpdir/usr/share/man/man1/${page_name}.1.gz" \
UTF-8 gz '' "$page_name \- coreutils $page_name manual page"
write_page "$page_name" 2 "$tmpdir/usr/share/man/man2/${page_name}.2.gz" \
UTF-8 gz '' "$page_name \- $page_name() syscall manual page"
cat >"$tmpdir/2.exp" <<EOF
$abstmpdir/usr/share/man/man2/${page_name}.2.gz
EOF
run $MAN -C "$tmpdir/manpath.config" -aw "$page_name".2 >"$tmpdir/2.out"
expect_pass '"man name.2" is the same as "man 2 name"' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
(
cd "$tmpdir/usr/share/man/man2/"
mv "${page_name}.2.gz" "${page_name}.2p.gz"
)
cat >"$tmpdir/2p.exp" <<EOF
$abstmpdir/usr/share/man/man2/${page_name}.2p.gz
EOF
run $MAN -C "$tmpdir/manpath.config" -aw "$page_name".2p >"$tmpdir/2p.out"
expect_pass '"man name.2p" is the same as "man 2p name"' \
'diff -u "$tmpdir/2p.exp" "$tmpdir/2p.out"'
finish

View File

@ -1,23 +0,0 @@
#! /bin/sh
# Test for:
# http://bugs.debian.org/608490
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
write_page file 1 "$tmpdir/file.1" UTF-8 '' '' 'file \- test'
chmod +x "$tmpdir/file.1"
PATH="$PATH:$tmpdir" run $MAN \
-C "$tmpdir/manpath.config" "$tmpdir/file.1" >/dev/null
code=$?
expect_pass 'executable page on path' 'test "$code" = 0'
finish

View File

@ -1,41 +0,0 @@
#! /bin/sh
# Test for:
# https://bugzilla.redhat.com/show_bug.cgi?id=684977
: ${srcdir=.}
. "$srcdir/testlib.sh"
case $MANDIR_LAYOUT in
""|GNU)
;;
*)
skip "only applicable to GNU layout"
;;
esac
: ${MAN=man}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
# Force default section order.
cat >>"$tmpdir/manpath.config" <<EOF
SECTION 1 n l 8 3 0 2 5 4 9 6 7
EOF
write_page md5sum 3pm "$tmpdir/usr/share/man/man3/open.3pm.gz" \
UTF-8 gz '' 'open \- section 3pm'
write_page md5sum 3p "$tmpdir/usr/share/man/man3p/open.3p.gz" \
UTF-8 gz '' 'open \- section 3p'
cat >"$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man3p/open.3p.gz
$abstmpdir/usr/share/man/man3/open.3pm.gz
EOF
run $MAN -C "$tmpdir/manpath.config" -aw 3p open >"$tmpdir/1.out"
expect_pass 'exact section matches win' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,173 +0,0 @@
#! /bin/sh
# Test for wildcards in MANDATORY_MANPATH in config file and in MANPATH.
# https://bugzilla.redhat.com/show_bug.cgi?id=677669
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
> "$tmpdir/manpath.config"
MAN_TEST_DISABLE_PATH=1
export MAN_TEST_DISABLE_PATH
write_page manx 1 "$tmpdir/usr/share/man/man1/manx.1.gz" \
UTF-8 gz '' 'manx \- an interface to the on-line reference manuals'
write_page manpathx 1 "$tmpdir/usr/share/prog/a/man/man1/manpathx.1.gz" \
UTF-8 gz '' 'manpathx \- determine search path for manual pages'
write_page whatisx 1 "$tmpdir/usr/share/prog/b/man/man1/whatisx.1.gz" \
UTF-8 gz '' 'whatisx \- display manual page descriptions'
#
# Testing -M option
#
# Without wildcards
Mpath="$tmpdir/usr/share/man"
run $MAN -C "$tmpdir/manpath.config" \
-aw -M "${Mpath}" manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: -M option: without wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw -M "${Mpath}" manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: -M option: without wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
# With wildcards
Mpath="$tmpdir/usr/share/prog/*/man"
run $MAN -C "$tmpdir/manpath.config" \
-aw -M "${Mpath}" manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: -M option: with wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw -M "${Mpath}" manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: -M option: with wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
Mpath="$tmpdir/usr/share/prog/[ab]/man"
run $MAN -C "$tmpdir/manpath.config" \
-aw -M "${Mpath}" whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: -M option: with wildcards: check existing man page II' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
#
# Testing MANPATH
#
# Without wildcards
MANPATH="$tmpdir/usr/share/man"
export MANPATH
run $MAN -C "$tmpdir/manpath.config" \
-aw manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANPATH: without wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: MANPATH: without wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
# With wildcards
MANPATH="$tmpdir/usr/share/prog/*/man"
export MANPATH
run $MAN -C "$tmpdir/manpath.config" \
-aw manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANPATH: with wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: MANPATH: with wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
MANPATH="$tmpdir/usr/share/prog/[ab]/man"
export MANPATH
run $MAN -C "$tmpdir/manpath.config" \
-aw whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: MANPATH: with wildcards: check existing man page II' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
unset MANPATH
#
# Testing MANDATORY_MANPATH
#
# Without wildcards
fake_config /usr/share/man
run $MAN -C "$tmpdir/manpath.config" \
-aw manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANDATORY_MANPATH: without wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: without wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
# With wildcards
fake_config "/usr/share/prog/*/man"
run $MAN -C "$tmpdir/manpath.config" \
-aw manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check missing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" \
-aw manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check existing man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
fake_config "/usr/share/prog/[ab]/man"
run $MAN -C "$tmpdir/manpath.config" \
-aw whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check existing man page II' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,90 +0,0 @@
#! /bin/sh
# Test for relative .so links between man pages in the same section (e.g. ".so bar.1").
# https://bugzilla.redhat.com/show_bug.cgi?id=693458
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
cat >"$tmpdir/fake-program" <<EOF
#! /bin/sh
exec cat
EOF
chmod +x "$tmpdir/fake-program"
PATH="$abstmpdir:$PATH"
export PATH
cat >>"$tmpdir/manpath.config" <<EOF
DEFINE tbl fake-program
DEFINE nroff fake-program
EOF
# There are 2 kind of tests. First, when destination is not gzipped, what means
# that .so link contains full filename and second, when the destination is
# gzipped, and .so link doesn't contain the file suffix.
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- top-level test page'
echo '.so man1/test.1' >"$tmpdir/usr/share/man/man1/test-fullso.1"
echo '.so test.1' >"$tmpdir/usr/share/man/man1/test-relso.1"
write_page testb 1 "$tmpdir/usr/share/man/man1/testb.1.gz" \
UTF-8 'gz' '' 'testb \- top-level test page'
echo '.so man1/testb.1' >"$tmpdir/usr/share/man/man1/test-fullsob.1"
echo '.so testb.1' >"$tmpdir/usr/share/man/man1/test-relsob.1"
cat >"$tmpdir/1.exp" <<'EOF'
.TH test 1
.SH NAME
test \- top-level test page
.SH DESCRIPTION
test
EOF
cat >"$tmpdir/2.exp" <<'EOF'
.TH testb 1
.SH NAME
testb \- top-level test page
.SH DESCRIPTION
test
EOF
run $MAN -C "$tmpdir/manpath.config" test | \
grep -v '^\.l[flt] ' >"$tmpdir/1.out"
expect_pass 'test(1) without .so link' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -C "$tmpdir/manpath.config" test-fullso | \
grep -v '^\.l[flt] ' >"$tmpdir/2.out"
expect_pass 'test-fullso(1) .so link with section' \
'diff -u "$tmpdir/1.exp" "$tmpdir/2.out"'
run $MAN -C "$tmpdir/manpath.config" test-relso | \
grep -v '^\.l[flt] ' >"$tmpdir/3.out"
expect_pass 'test-relso(1) .so link without section' \
'diff -u "$tmpdir/1.exp" "$tmpdir/3.out"'
run $MAN -C "$tmpdir/manpath.config" testb | \
grep -v '^\.l[flt] ' >"$tmpdir/4.out"
expect_pass 'testb(1) without .so link; gzipped' \
'diff -u "$tmpdir/2.exp" "$tmpdir/4.out"'
run $MAN -C "$tmpdir/manpath.config" test-fullsob | \
grep -v '^\.l[flt] ' >"$tmpdir/5.out"
expect_pass 'test-fullsob(1) .so link with section; gzipped' \
'diff -u "$tmpdir/2.exp" "$tmpdir/5.out"'
run $MAN -C "$tmpdir/manpath.config" test-relsob | \
grep -v '^\.l[flt] ' >"$tmpdir/6.out"
expect_pass 'test-relsob(1) .so link without section; gzipped' \
'diff -u "$tmpdir/2.exp" "$tmpdir/6.out"'
finish

View File

@ -1,28 +0,0 @@
#! /bin/sh
# Testing empty locales on systems without /usr/share/i18n/SUPPORTED file.
# https://bugzilla.redhat.com/show_bug.cgi?id=657409
#
# File /usr/share/i18n/SUPPORTED must be missing for this test to be effective.
#
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/share/man
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- top-level test page'
LANG=
LC_CTYPE=
LC_ALL=
run $MAN -C "$tmpdir/manpath.config" -E UTF-8 test > /dev/null
# $? is deliberately expanded here.
expect_pass 'missing locales' "test $? -eq 0"
finish

View File

@ -1,31 +0,0 @@
#! /bin/sh
# Test for invalid DB entry.
# https://bugzilla.redhat.com/show_bug.cgi?id=841431
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
: ${MANDB=mandb}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
MAN_TEST_DISABLE_UNDOCUMENTED=1
export MAN_TEST_DISABLE_UNDOCUMENTED
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- top-level test page'
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
rm -f "$tmpdir/usr/share/man/man1/test.1"
echo "No manual entry for test" > "$tmpdir/1.exp"
LC_ALL=C run $MAN -C "$tmpdir/manpath.config" test 2> "$tmpdir/1.out"
expect_pass 'invalid DB entry' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,58 +0,0 @@
#! /bin/sh
# Test additional language-specific requests for localized man pages.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
cat >"$tmpdir/fake-program" <<EOF
#! /bin/sh
exec cat
EOF
chmod +x "$tmpdir/fake-program"
PATH="$abstmpdir:$PATH"
export PATH
cat >>"$tmpdir/manpath.config" <<EOF
DEFINE tbl fake-program
DEFINE nroff fake-program
EOF
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- top-level test page'
write_page test 1 "$tmpdir/usr/share/man/xyzzy/man1/test.1" \
UTF-8 '' '' 'test \- xyzzy language page for test'
write_page xyz 1 "$tmpdir/usr/share/man/man1/xyz.1" \
UTF-8 '' '' 'test \- top-level xyz page'
cat >"$tmpdir/1.exp" <<'EOF'
. mso xyzzy.tmac
.hla xyzzy
test \- xyzzy language page for test
EOF
cat >"$tmpdir/2.exp" <<'EOF'
.TH xyz 1
test \- top-level xyz page
EOF
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" test |\
grep 'xyzzy' >"$tmpdir/1.out"
expect_pass 'language-specific requests for localized man page' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" xyz |\
grep 'xyz' >"$tmpdir/2.out"
expect_pass 'no language-specific requests for top-level man page' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
finish

View File

@ -1,46 +0,0 @@
#! /bin/sh
# Testing override dir. This test covers both use cases - when override dir is
# enabled and when it's not.
#
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
if [ -n "$OVERRIDE_DIR" ]; then
OVERRIDE=$OVERRIDE_DIR
else
OVERRIDE="override"
fi
init
fake_config /usr/share/man
mkdir -p "${tmpdir}/usr/share/man/${OVERRIDE}/man1"
MANPATH="$tmpdir/usr/share/man"
export MANPATH
write_page abc 1 "${tmpdir}/usr/share/man/man1/abc.1" \
UTF-8 '' '' 'abc \- top-level test page'
write_page abc 1 "${tmpdir}/usr/share/man/${OVERRIDE}/man1/abc.1" \
UTF-8 '' '' 'abc \- modified test page'
if [ -n "$OVERRIDE_DIR" ]; then
cat >"$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/${OVERRIDE}/man1/abc.1
$abstmpdir/usr/share/man/man1/abc.1
EOF
else
cat >"$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/abc.1
EOF
fi
run $MAN -C "$tmpdir/manpath.config" -aw abc >"$tmpdir/1.out"
expect_pass 'testing override dir' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,43 +0,0 @@
#! /bin/sh
# Test manconv's support for Emacs-style coding: tags.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANCONV=manconv}
init
cat >"$tmpdir/1.exp" <<'EOF'
'\" -*- coding: ISO-8859-1
á
EOF
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/1.exp" >"$tmpdir/1.inp"
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.out"
expect_pass 'simple coding tag' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
cat >"$tmpdir/2.exp" <<'EOF'
'\" -*- mode: troff; coding: ISO-8859-1
á
EOF
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/2.exp" >"$tmpdir/2.inp"
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.out"
expect_pass 'mode and coding tags' 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
cat >"$tmpdir/3.exp" <<'EOF'
'\" -*- mode: troff; coding: ISO-LATIN-1
á
EOF
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/3.exp" >"$tmpdir/3.inp"
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/3.inp" >"$tmpdir/3.out"
expect_pass 'iso-latin-1 coding alias' 'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
cat >"$tmpdir/4.inp" <<'EOF'
'\" -*- nroff -*-
EOF
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/4.inp" >"$tmpdir/4.out"
expect_pass 'preprocessor comment but no coding tag' \
'diff -u "$tmpdir/4.inp" "$tmpdir/4.out"'
finish

View File

@ -1,75 +0,0 @@
#! /bin/sh
# Test manconv's handling of various odd encoding combinations.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANCONV=manconv}
init
(for x in $(seq 160 255); do
printf "\\$(printf %03o "$x")"
done
echo) >"$tmpdir/1.inp"
iconv -f ISO-8859-1 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.exp"
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.out"
expect_pass '-f UTF-8:ISO-8859-1 -t UTF-8 on ISO-8859-1 input' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
iconv -f ISO-8859-2 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1-latin2.exp"
run $MANCONV -f UTF-8:ISO-8859-2 -t UTF-8 \
<"$tmpdir/1.inp" >"$tmpdir/1-latin2.out"
expect_pass '-f UTF-8:ISO-8859-2 -t UTF-8 on ISO-8859-2 input' \
'diff -u "$tmpdir/1-latin2.exp" "$tmpdir/1-latin2.out"'
(for x in $(seq 1 1000); do
printf ''
done
echo 'Б' | iconv -f UTF-8 -t KOI8-R
echo '') >"$tmpdir/2.inp"
iconv -f KOI8-R -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.exp"
run $MANCONV -f UTF-8:KOI8-R -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.out"
expect_pass '-f UTF-8:KOI8-R -t UTF-8 on KOI8-R input with UTF-8 prefix' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
(for x in $(seq 160 255); do
printf "\\$(printf %03o "$x")"
done
echo) | iconv -f ISO-8859-1 -t UTF-8 >"$tmpdir/3.inp"
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8 <"$tmpdir/3.inp" >"$tmpdir/3.out"
expect_pass '-f UTF-8:ISO-8859-1 -t UTF-8 preserves UTF-8 input' \
'diff -u "$tmpdir/3.inp" "$tmpdir/3.out"'
# U+00B7 MIDDLE DOT is not representable in ISO-8859-2, and so should be
# omitted. However, manconv should still recognise that the input was UTF-8
# rather than falling back to ISO-8859-2.
cat >"$tmpdir/4.inp" <<'EOF'
š·ł
EOF
iconv -f UTF-8 -t ISO-8859-2 >"$tmpdir/4.exp" <<EOF
šł
EOF
run $MANCONV -f UTF-8:ISO-8859-2 -t ISO-8859-2//IGNORE \
<"$tmpdir/4.inp" >"$tmpdir/4.out"
expect_pass 'recognises input encoding and omits invalid output character' \
'diff -u "$tmpdir/4.exp" "$tmpdir/4.out"'
# 0xAE does not exist in ISO-8859-7, so manconv won't be able to recode this
# to UTF-8 without conversion errors. (In the original case where this was
# seen in the wild, the coding: tag should actually have read ISO-8859-13.)
iconv -f UTF-8 -t ISO-8859-13 >"$tmpdir/5.inp" <<'EOF'
'\" -*- coding: ISO-8859-7
REGISTERED SIGN: ®
trailing data
EOF
iconv -f ISO-8859-7 -t UTF-8//IGNORE \
<"$tmpdir/5.inp" >"$tmpdir/5.exp" 2>/dev/null
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE \
<"$tmpdir/5.inp" >"$tmpdir/5.out"
expect_pass 'copes with invalid input characters' \
'diff -u "$tmpdir/5.exp" "$tmpdir/5.out"'
finish

View File

@ -1,15 +0,0 @@
#! /bin/sh
# Test manconv's handling of incomplete characters at end of file.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANCONV=manconv}
init
printf '\314' >"$tmpdir/1.inp" # 0xCC
expect_pass 'incomplete character at EOF' '! run $MANCONV -f EUC-JP -t UTF-8//IGNORE <"$tmpdir/1.inp" >/dev/null'
finish

View File

@ -1,24 +0,0 @@
#! /bin/sh
# Basic mandb tests.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${ACCESSDB=accessdb}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
db_ext="$(db_ext)"
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" UTF-8 gz t \
'test \- simple mandb test'
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
echo 'test -> "- 1 1 MTIME A - - gz simple mandb test"' >"$tmpdir/1.exp"
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
expect_pass 'simple mandb test' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,67 +0,0 @@
#! /bin/sh
# What happens when a manual page changes from a regular file to a symbolic
# link and back?
# http://bugs.debian.org/490582
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${ACCESSDB=accessdb}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
db_ext="$(db_ext)"
write_page fs 5 "$tmpdir/usr/share/man/man5/fs.5.gz" \
UTF-8 gz t 'fs \- fs(5)'
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/1.exp" <<EOF
fs -> "- 5 5 MTIME A - - gz fs(5)"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
expect_pass 'fs(5) setup' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
./fspause
write_page filesystems 5 "$tmpdir/usr/share/man/man5/filesystems.5.gz" \
UTF-8 gz t 'filesystems \- filesystems(5)'
ln -sf filesystems.5.gz "$tmpdir/usr/share/man/man5/fs.5.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/2.exp" <<EOF
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
fs -> "- 5 5 MTIME B - - gz filesystems(5)"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2.out"
expect_pass 'mandb notices regular file -> symlink' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
./fspause
ln -sf fs.5.gz "$tmpdir/usr/share/man/man5/fs2.5.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/3.exp" <<EOF
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
fs -> "- 5 5 MTIME B - - gz filesystems(5)"
fs2 -> "- 5 5 MTIME B - - gz filesystems(5)"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/3.out"
expect_pass 'mandb notices two-level symlink' \
'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
./fspause
rm -f "$tmpdir/usr/share/man/man5/fs.5.gz"
write_page fs 5 "$tmpdir/usr/share/man/man5/fs.5.gz" \
UTF-8 gz t 'fs \- new fs(5)'
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/4.exp" <<EOF
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
fs -> "- 5 5 MTIME A - - gz new fs(5)"
fs2 -> "- 5 5 MTIME B - - gz filesystems(5)"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/4.out"
expect_pass 'mandb notices symlink -> regular file' \
'diff -u "$tmpdir/4.exp" "$tmpdir/4.out"'
finish

View File

@ -1,55 +0,0 @@
#! /bin/sh
# Ensure that we don't repeatedly rescan when a whatis entry turns into a
# broken link.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${ACCESSDB=accessdb}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
db_ext="$(db_ext)"
NL='
'
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" UTF-8 gz t \
"test \- test page${NL}.br${NL}testlink \- link to test page"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/1.exp" <<EOF
test -> "- 1 1 MTIME A - - gz test page"
testlink -> "- 1 1 MTIME C test - gz "
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
expect_pass 'setup' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
./fspause
echo '.so nonexistent.1' | gzip -9c >"$tmpdir/usr/share/man/man1/testlink.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
cat >"$tmpdir/2.exp" <<EOF
test -> "- 1 1 MTIME A - - gz test page"
testlink -> "- 1 1 MTIME C test - gz "
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2.out"
expect_pass 'broken whatis' 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
./fspause
LC_ALL=C run $MANDB -C "$tmpdir/manpath.config" -u \
"$tmpdir/usr/share/man" >"$tmpdir/3.out" 2>/dev/null
cat >"$tmpdir/3.exp" <<EOF
Purging old database entries in $abstmpdir/usr/share/man...
Processing manual pages under $abstmpdir/usr/share/man...
Processing manual pages under $abstmpdir/usr/share/man/cat1...
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.
EOF
expect_pass 'mandb does not rescan' 'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
finish

View File

@ -1,60 +0,0 @@
#! /bin/sh
# Test for:
# http://bugs.debian.org/204249
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${ACCESSDB=accessdb}
init
fake_config /usr/share/man /usr/X11R6/man
MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
export MANPATH
db_ext="$(db_ext)"
write_page xterm 1x "$tmpdir/usr/X11R6/man/man1/xterm.1x.gz" \
UTF-8 gz '' 'xterm \- terminal emulator for X'
mkdir -p "$tmpdir/usr/share/man/man1"
ln -s ../../../X11R6/man/man1/xterm.1x.gz \
"$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
"$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
cat >"$tmpdir/1-share.exp" <<EOF
x-terminal-emulator -> "- 1 1 MTIME B - - gz terminal emulator for X"
EOF
cat >"$tmpdir/1-X11R6.exp" <<EOF
xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1-share.out"
accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/1-X11R6.out"
expect_pass '/usr/share/man x-terminal-emulator -> xterm' \
'diff -u "$tmpdir/1-share.exp" "$tmpdir/1-share.out"'
expect_pass '/usr/X11R6/man x-terminal-emulator -> xterm' \
'diff -u "$tmpdir/1-X11R6.exp" "$tmpdir/1-X11R6.out"'
./fspause
write_page uxterm 1x "$tmpdir/usr/X11R6/man/man1/uxterm.1x.gz" \
UTF-8 gz '' \
'uxterm \- X terminal emulator for Unicode (UTF-8) environments'
ln -sf ../../../X11R6/man/man1/uxterm.1x.gz \
"$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
"$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
cat >"$tmpdir/2-share.exp" <<EOF
x-terminal-emulator -> "- 1 1 MTIME B - - gz X terminal emulator for Unicode (UTF-8) environments"
EOF
cat >"$tmpdir/2-X11R6.exp" <<EOF
uxterm -> "- 1x 1 MTIME A - - gz X terminal emulator for Unicode (UTF-8) environments"
xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2-share.out"
accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/2-X11R6.out"
expect_pass '/usr/share/man x-terminal-emulator -> uxterm' \
'diff -u "$tmpdir/2-share.exp" "$tmpdir/2-share.out"'
expect_pass '/usr/X11R6/man x-terminal-emulator -> uxterm' \
'diff -u "$tmpdir/2-X11R6.exp" "$tmpdir/2-X11R6.out"'
finish

View File

@ -1,30 +0,0 @@
#! /bin/sh
# Test handling of empty files.
# http://bugs.debian.org/622104
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
init
fake_config /usr/share/man /usr/X11R6/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
db_ext="$(db_ext)"
mkdir -p "$tmpdir/usr/share/man/man1"
touch "$tmpdir/usr/share/man/man1/empty.1"
gzip -9 "$tmpdir/usr/share/man/man1/empty.1"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
# $? is deliberately expanded here.
expect_pass 'empty page' "test $? -eq 0"
./fspause
ln -s empty.1.gz "$tmpdir/usr/share/man/man1/empty2.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
# $? is deliberately expanded here.
expect_pass 'symlink to empty page' "test $? -eq 0"
finish

View File

@ -1,25 +0,0 @@
#! /bin/sh
# Test for double free or corruption crash with bogus filename and symlink of man page.
# https://bugzilla.redhat.com/show_bug.cgi?id=702904
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
init
fake_config /usr/share/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH
mkdir -p "$tmpdir/usr/share/man/man8"
mkdir -p "$tmpdir/usr/lib/aa-bbb"
write_page test1 8 "$tmpdir/usr/lib/aa-bbb/aa-test1.8.gz" UTF-8 gz t \
'test1 \- testing man page'
ln -s "../../../lib/aa-bbb/aa-test1.8.gz" "$tmpdir/usr/share/man/man8/aa-test1.8.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
# $? is deliberately expanded here.
expect_pass 'double free' "test $? -eq 0"
finish

View File

@ -1,28 +0,0 @@
#! /bin/sh
# Don't create CACHEDIR.TAG in manpath
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
init
fake_config /usr/share/man
mkdir -p "$tmpdir/usr/share/man"
mkdir -p "$tmpdir/usr/dir/man"
mkdir -p "$tmpdir/var/cache/man"
echo "MANDATORY_MANPATH $abstmpdir/usr/share/man" > "$tmpdir/manpath.config"
echo "MANDATORY_MANPATH $abstmpdir/usr/dir/man" >> "$tmpdir/manpath.config"
echo "MANDB_MAP $abstmpdir/usr/share/man $abstmpdir/var/cache/man" >> "$tmpdir/manpath.config"
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" UTF-8 '' '' \
'test \- simple mandb test'
write_page test2 1 "$tmpdir/usr/dir/man/man1/test2.1" UTF-8 '' '' \
'test2 \- simple mandb test'
run $MANDB -C "$tmpdir/manpath.config" -q "$tmpdir/usr/share/man:$tmpdir/usr/dir/man"
expect_pass "CACHEDIR.TAG exists" "[ -e $tmpdir/var/cache/man/CACHEDIR.TAG ]"
expect_pass "CACHEDIR.TAG doesn't exist 01" "[ ! -e $tmpdir/usr/share/man/CACHEDIR.TAG ]"
expect_pass "CACHEDIR.TAG doesn't exist 02" "[ ! -e $tmpdir/usr/dir/man/CACHEDIR.TAG ]"
finish

View File

@ -1,105 +0,0 @@
failures=0
# Save tests the trouble of exporting variables they set when executing 'run'.
export LC_ALL
# Isolate tests from whatever the system configuration may happen to be.
MAN_TEST_DISABLE_SYSTEM_CONFIG=1
export MAN_TEST_DISABLE_SYSTEM_CONFIG
init () {
# Create a temporary directory in /tmp or ./ ,
# put path to it into $tmpdir and $abstmpdir,
# remove it on exit.
{
tmpdir=$(mktemp -d) &&
abstmpdir="$tmpdir" &&
test -d "$tmpdir"
} || {
tmpdir="tmp-${0##*/}"
abstmpdir="$(pwd -P)/$tmpdir"
mkdir "$tmpdir"
} ||
exit $?
trap 'rm -rf "$tmpdir"' HUP INT QUIT TERM
}
run () {
"$@"
}
fake_config () {
for dir; do
echo "MANDATORY_MANPATH $tmpdir$dir"
done >"$tmpdir/manpath.config"
}
db_ext () {
case $DBTYPE in
gdbm) echo .db ;;
btree) echo .bt ;;
esac
}
# Arguments: name section path encoding compression_extension preprocessor_line name_line
write_page () {
mkdir -p "${3%/*}"
>"$3.tmp1"
if [ "$6" ]; then
echo "'\\\" $6" >>"$3.tmp1"
fi
cat >>"$3.tmp1" <<EOF
.TH $1 $2
.SH NAME
$7
.SH DESCRIPTION
test
EOF
iconv -f UTF-8 -t "$4" <"$3.tmp1" >"$3.tmp2"
case $5 in
'') cat ;;
gz|z) gzip -9c ;;
Z) compress -c ;;
bz2) bzip2 -9c ;;
lzma) lzma -9c ;;
esac <"$3.tmp2" >"$3"
rm -f "$3.tmp1" "$3.tmp2"
}
accessdb_filter () {
# e.g. 'test -> "- 1 1 1250702063 A - - gz simple mandb test"'
run $ACCESSDB "$1" | grep -v '^\$' | \
sed 's/\(-> "[^ ][^ ]* [^ ][^ ]* [^ ][^ ]* \)[^ ][^ ]* [^ ][^ ]* /\1MTIME /'
}
expect_pass () {
ret=0
eval "$2" || ret=$?
if [ "$ret" = 0 ]; then
echo " PASS: $1"
else
failures="$(($failures + 1))"
echo " FAIL: $1"
fi
}
skip () {
echo " SKIP: $1"
rm -rf "$abstmpdir"
exit 77
}
finish () {
case $failures in
0)
rm -rf "$abstmpdir"
exit 0
;;
*)
if [ -z "$TEST_FAILURE_KEEP" ]; then
rm -rf "$abstmpdir"
fi
exit 1
;;
esac
}

View File

@ -1,56 +0,0 @@
#! /bin/sh
# Test that whatis behaves appropriately when given a path to an executable.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${WHATIS=whatis}
init
fake_config /usr/share/man /usr/local/man
cat >>"$tmpdir/manpath.config" <<EOF
MANPATH_MAP $tmpdir/usr/bin $tmpdir/usr/share/man
MANPATH_MAP $tmpdir/usr/local/bin $tmpdir/usr/local/man
EOF
MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/local/man"
export MANPATH
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" \
UTF-8 gz '' 'test \- /usr/bin/test'
write_page test 8 "$tmpdir/usr/local/man/man8/test.8.gz" \
UTF-8 gz '' 'test \- /usr/local/bin/test'
mkdir -p "$tmpdir/usr/bin" "$tmpdir/usr/local/bin"
touch "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test"
chmod +x "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
"$tmpdir/usr/share/man:$tmpdir/usr/local/man"
cat >"$tmpdir/1.exp" <<EOF
test (1) - /usr/bin/test
test (8) - /usr/local/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" test >"$tmpdir/1.out"
expect_pass 'simple name returns all matches' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
cat >"$tmpdir/2.exp" <<EOF
test (1) - /usr/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" "$tmpdir/usr/bin/test" >"$tmpdir/2.out"
expect_pass '/usr/bin/test only returns appropriate match' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
cat >"$tmpdir/3.exp" <<EOF
test (8) - /usr/local/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" "$tmpdir/usr/local/bin/test" \
>"$tmpdir/3.out"
expect_pass '/usr/local/bin/test only returns appropriate match' \
'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
finish

View File

@ -1,61 +0,0 @@
#! /bin/sh
# Test for:
# http://bugs.debian.org/503472
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MAN=man}
init
fake_config /usr/local/man /usr/share/man
MANPATH="$tmpdir/usr/local/man:$tmpdir/usr/share/man"
export MANPATH
cat >"$tmpdir/fake-program" <<EOF
#! /bin/sh
exec cat
EOF
chmod +x "$tmpdir/fake-program"
PATH="$abstmpdir:$PATH"
export PATH
cat >>"$tmpdir/manpath.config" <<EOF
DEFINE tbl fake-program
DEFINE nroff fake-program
EOF
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
UTF-8 '' '' 'test \- top-level test page'
echo '.so man7/test2.7' >>"$tmpdir/usr/share/man/man1/test.1"
write_page test2 7 "$tmpdir/usr/local/man/man7/test2.7" \
UTF-8 '' '' 'test2 \- second-level local test page'
echo '.so test3.1' >>"$tmpdir/usr/local/man/man7/test2.7"
write_page test3 1 "$tmpdir/usr/local/man/man1/test3.1" \
UTF-8 '' '' 'test3 \- third-level local test page'
write_page test3 1 "$tmpdir/usr/share/man/man1/test3.1" \
UTF-8 '' '' 'test3 \- third-level test page'
cat >"$tmpdir/1.exp" <<'EOF'
.TH test 1
.SH NAME
test \- top-level test page
.SH DESCRIPTION
test
.TH test2 7
.SH NAME
test2 \- second-level local test page
.SH DESCRIPTION
test
.TH test3 1
.SH NAME
test3 \- third-level test page
.SH DESCRIPTION
test
EOF
run $MAN -C "$tmpdir/manpath.config" test | \
grep -v '^\.l[flt] ' >"$tmpdir/1.out"
expect_pass 'test(1) expanded correctly' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
finish

View File

@ -1,13 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- atomic
- classic
- container
tests:
- upstream-test-suite
required_packages:
- man-db
- gcc
- make

View File

@ -1,27 +0,0 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh
TEST="/BaseOS/man-db/Sanity/upstream-test-suite"
PACKAGES=${PACKAGES:-"man-db"}
REQUIRES=${REQUIRES:-"gcc make"}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp -r man-db/* $TmpDir/." 0 "Copying test suite"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "make test" 0 "Running tests"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd