1999-12-13 15:03:51 +00:00
|
|
|
#!/bin/sh
|
1999-12-15 10:15:36 +00:00
|
|
|
# Exercise a bug that was fixed in shred-4.0l
|
1999-12-13 15:03:51 +00:00
|
|
|
|
|
|
|
|
if test "$VERBOSE" = yes; then
|
|
|
|
|
set -x
|
|
|
|
|
shred --version
|
|
|
|
|
fi
|
|
|
|
|
|
2000-05-23 21:14:33 +00:00
|
|
|
pwd=`pwd`
|
1999-12-13 15:03:51 +00:00
|
|
|
tmp=t-shred.$$
|
2000-05-23 21:14:33 +00:00
|
|
|
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
|
|
|
|
trap 'exit $?' 1 2 13 15
|
1999-12-13 15:03:51 +00:00
|
|
|
|
1999-12-15 10:15:36 +00:00
|
|
|
# The length of the basename is what matters.
|
|
|
|
|
# In this case, shred would try to rename the file 256^10 times
|
|
|
|
|
# before terminating.
|
|
|
|
|
file=$tmp/0123456789
|
|
|
|
|
|
1999-12-13 15:03:51 +00:00
|
|
|
framework_failure=0
|
|
|
|
|
mkdir $tmp || framework_failure=1
|
1999-12-22 14:30:23 +00:00
|
|
|
touch $file || framework_failure=1
|
2000-05-23 21:14:33 +00:00
|
|
|
chmod u-w $file || framework_failure=1
|
1999-12-13 15:03:51 +00:00
|
|
|
|
|
|
|
|
if test $framework_failure = 1; then
|
|
|
|
|
echo 'failure in testing framework'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2000-05-23 21:14:33 +00:00
|
|
|
(echo foo >> $file) >/dev/null 2>&1 && {
|
2000-01-12 14:00:22 +00:00
|
|
|
echo '********************************************'
|
2000-05-23 21:14:33 +00:00
|
|
|
echo "$0: NOTICE: This test case cannot be run as root."
|
2000-01-12 14:00:22 +00:00
|
|
|
echo '********************************************'
|
1999-12-22 14:30:23 +00:00
|
|
|
exit 77
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 15:03:51 +00:00
|
|
|
fail=0
|
|
|
|
|
|
1999-12-15 10:15:36 +00:00
|
|
|
# This would take so long that it appears to infloop
|
|
|
|
|
# when using version from fileutils-4.0k.
|
|
|
|
|
# When the command completes, expect it to fail.
|
1999-12-22 14:30:23 +00:00
|
|
|
shred -u $file > /dev/null 2>&1 && fail=1
|
1999-12-13 15:03:51 +00:00
|
|
|
|
1999-12-13 22:37:15 +00:00
|
|
|
chmod u+w $tmp
|
1999-12-13 15:03:51 +00:00
|
|
|
rm -rf $tmp
|
|
|
|
|
|
|
|
|
|
exit $fail
|