summaryrefslogtreecommitdiffstats
path: root/src/tests/man-symlinks-with-matching-names
blob: f8c3bb8126f6d999091c669729131dc45f4b9be7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/sh

# Test for:
#   https://bugs.debian.org/163347

: "${srcdir=.}"
# shellcheck source-path=SCRIPTDIR
. "$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_files_equal 'symlinks with matching names win' \
	"$tmpdir/1.exp" "$tmpdir/1.out"

finish