diff options
author | Colin Watson <cjwatson@debian.org> | 2009-08-20 07:47:30 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-08-20 07:47:30 +0100 |
commit | 3f1ce3b43fd12aae5531aea791a03a3f3b07aad2 (patch) | |
tree | 2025e6b007fa1805f71afb933f8bcb75358dd7f3 /src | |
parent | 93f78a9312121ed19c00fd34b9f9bc732620db06 (diff) |
* src/man.c (run_mandb): If -C was given, pass it through to mandb.
(main): Treat the main configuration file as optional if -C was
given.
* src/tests/testlib.sh (fake_config): Take the manual page
hierarchies to use as arguments.
(run_clean_path): New function.
* src/tests/man-1: New test, for Debian bug #163347 (apparently
fixed some time back).
* src/tests/Makefile.am (TESTS_ENVIRONMENT): Set CLEANPATH, so that
run_clean_path can run commands with a reduced PATH.
(TESTS): Add man-1.
Diffstat (limited to 'src')
-rw-r--r-- | src/man.c | 5 | ||||
-rw-r--r-- | src/tests/Makefile.am | 3 | ||||
-rw-r--r-- | src/tests/Makefile.in | 3 | ||||
-rwxr-xr-x | src/tests/man-1 | 29 | ||||
-rwxr-xr-x | src/tests/mandb-1 | 2 | ||||
-rw-r--r-- | src/tests/testlib.sh | 14 |
6 files changed, 49 insertions, 7 deletions
@@ -802,6 +802,9 @@ static int run_mandb (int create, const char *manpath, const char *filename) else command_arg (mandb_cmd, "-q"); + if (user_config_file) + command_args (mandb_cmd, "-C", user_config_file, NULL); + if (filename) command_args (mandb_cmd, "-f", filename, NULL); else if (create) @@ -973,7 +976,7 @@ int main (int argc, char *argv[]) pipeline_install_sigchld (); - read_config_file (local_man_file); + read_config_file (local_man_file || user_config_file); /* if the user wants whatis or apropos, give it to them... */ if (external) diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 26f4c7db..fbf0c62a 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -18,9 +18,10 @@ ## 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=..:$$PATH DBTYPE=$(DBTYPE) $(SHELL) +TESTS_ENVIRONMENT = PATH=..:$$PATH CLEANPATH=.. DBTYPE=$(DBTYPE) $(SHELL) TESTS = \ lexgrog-1 \ + man-1 \ manconv-1 manconv-2 \ mandb-1 diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in index 34d9456a..58d18d38 100644 --- a/src/tests/Makefile.in +++ b/src/tests/Makefile.in @@ -820,9 +820,10 @@ troff = @troff@ uncompress = @uncompress@ unlzma = @unlzma@ vgrind = @vgrind@ -TESTS_ENVIRONMENT = PATH=..:$$PATH DBTYPE=$(DBTYPE) $(SHELL) +TESTS_ENVIRONMENT = PATH=..:$$PATH CLEANPATH=.. DBTYPE=$(DBTYPE) $(SHELL) TESTS = \ lexgrog-1 \ + man-1 \ manconv-1 manconv-2 \ mandb-1 diff --git a/src/tests/man-1 b/src/tests/man-1 new file mode 100755 index 00000000..a3d217c5 --- /dev/null +++ b/src/tests/man-1 @@ -0,0 +1,29 @@ +#! /bin/sh + +# Test for: +# http://bugs.debian.org/163347 + +: ${srcdir=.} +. "$srcdir/testlib.sh" + +: ${MAN=man} + +init +fake_config /usr/local/man /usr/share/man + +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 +$(pwd -P)/$tmpdir/usr/share/man/man1/md5sum.textutils.1.gz +$(pwd -P)/$tmpdir/usr/share/man/man1/md5sum.1.gz +EOF +run_clean_path $MAN -C "$tmpdir/manpath.config" -aw md5sum >"$tmpdir/1.out" +expect_pass 'symlinks with matching names win' \ + 'diff "$tmpdir/1.exp" "$tmpdir/1.out"' + +finish diff --git a/src/tests/mandb-1 b/src/tests/mandb-1 index 0d3b2e6a..8af44ff2 100755 --- a/src/tests/mandb-1 +++ b/src/tests/mandb-1 @@ -9,7 +9,7 @@ : ${ACCESSDB=accessdb} init -fake_config +fake_config /usr/share/man db_ext="$(db_ext)" write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" UTF-8 gz t \ diff --git a/src/tests/testlib.sh b/src/tests/testlib.sh index c1841bca..8311b5f6 100644 --- a/src/tests/testlib.sh +++ b/src/tests/testlib.sh @@ -7,9 +7,9 @@ init () { } fake_config () { - cat >"$tmpdir/manpath.config" <<EOF -MANDATORY_MANPATH $tmpdir/usr/share/man -EOF + for dir; do + echo "MANDATORY_MANPATH $tmpdir$dir" + done >"$tmpdir/manpath.config" } db_ext () { @@ -44,6 +44,14 @@ EOF rm -f "$3.tmp1" "$3.tmp2" } +run_clean_path () { + if [ "$CLEANPATH" ]; then + PATH="$CLEANPATH" "$@" + else + "$@" + fi +} + accessdb_filter () { # e.g. 'test -> "- 1 1 1250702063 A - - gz simple mandb test"' $ACCESSDB "$1" | grep -v '^\$' | \ |