coreutils/tests/du/deref
Jim Meyering 6dafd5b2fc whoops
2002-10-13 13:33:05 +00:00

34 lines
830 B
Bash
Executable File

#!/bin/sh
# prior to coreutils-4.5.3, du -D didn't work in some cases
# Based on an example from Andreas Schwab and/or Michal Svec.
if test "$VERBOSE" = yes; then
set -x
du --version
fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir -p a/sub || framework_failure=1
ln -s a/sub slink || framework_failure=1
touch b || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
# This used to fail with the following diagnostic:
# du: `b': No such file or directory
du -sD slink b > /dev/null 2>&1 || fail=1
(exit $fail); exit $fail