#! /bin/sh

# Test handling of empty files.
#   https://bugs.debian.org/622104

: "${srcdir=.}"
# shellcheck source-path=SCRIPTDIR
. "$srcdir/testlib.sh"

: "${MANDB=mandb}"

init
fake_config /usr/share/man /usr/X11R6/man
MANPATH="$tmpdir/usr/share/man"
export MANPATH

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"
report 'empty page' "$?"

./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"
report 'symlink to empty page' "$?"

finish
