"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test.sh" between
srm-1.2.14.tar.gz and srm-1.2.15.tar.gz

About: srm is a secure replacement for standard "rm" (to prevent command-line recovery it overwrites the data in the target files before unlinking them).

test.sh  (srm-1.2.14):test.sh  (srm-1.2.15)
skipping to change at line 23 skipping to change at line 23
testremove() testremove()
{ {
$SRM -rf "$1" $SRM -rf "$1"
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
echo could not remove $1 echo could not remove $1
exit 1 exit 1
fi fi
} }
# symlink # symlink
echo "testing symlinks..."
rm -f test.symlink
echo "TEST" > test.file echo "TEST" > test.file
if [ ! -f test.file ] ; then if [ ! -f test.file ] ; then
echo could not create test file echo could not create test file
exit 1 exit 1
fi fi
ln -s test.file test.symlink ln -s test.file test.symlink
if [ ! -L test.symlink ] ; then if [ ! -L test.symlink ] ; then
echo could not create symlink echo could not create symlink
exit 1 exit 1
fi fi
testremove test.symlink testremove test.symlink
# attributes I=`whoami`
if [ "$I" != root ] ; then
echo "testing symlink to root's files..."
ln -s /etc/fstab test.symlink
if [ ! -L test.symlink ] ; then
echo could not create symlink
exit 1
fi
testremove test.symlink
else
echo "can not test symlink to root's files, test.sh is run by root."
fi
# permissions
echo
echo "testing file permissions..."
echo "TEST" > test.file2 echo "TEST" > test.file2
chmod 000 test.file2 chmod 000 test.file2
testremove test.file2 testremove test.file2
# recursing into directories # recursing into directories
echo
echo "testing recursing into directories..."
rm -rf test.dir rm -rf test.dir
mkdir test.dir mkdir test.dir
if [ ! -d test.dir ] ; then if [ ! -d test.dir ] ; then
echo could not mkdir test.dir echo could not mkdir test.dir
exit 1 exit 1
fi fi
echo "TEST2" > test.dir/file2 echo "TEST2" > test.dir/file2
cd test.dir cd test.dir
ln -s file2 link2 ln -s file2 link2
if [ ! -L link2 ] ; then if [ ! -L link2 ] ; then
echo link2 echo link2
exit 1 exit 1
fi fi
cd .. cd ..
testremove test.dir testremove test.dir
# device nodes # device nodes
I=`whoami` echo
if [ "$I" = root ] ; then if [ "$I" = root ] ; then
echo "testing device nodes..."
mkdir test.dir2 mkdir test.dir2
echo "TEST" > test.dir2/test.file echo "TEST" > test.dir2/test.file
chmod 000 test.dir2/test.file chmod 000 test.dir2/test.file
chmod 000 test.dir2 chmod 000 test.dir2
testremove test.dir2 testremove test.dir2
mknod test.char c 1 1 mknod test.char c 1 1
if [ ! -c test.char ] ; then if [ ! -c test.char ] ; then
echo could not mknod test.char echo could not mknod test.char
skipping to change at line 84 skipping to change at line 104
fi fi
testremove test.char testremove test.char
mknod test.block b 1 1 mknod test.block b 1 1
if [ ! -b test.block ] ; then if [ ! -b test.block ] ; then
echo could not mknod test.block echo could not mknod test.block
exit 1 exit 1
fi fi
testremove test.block testremove test.block
else
echo "not running test.sh as root, not testing device nodes"
fi fi
# FIFO special file # FIFO special file
echo
echo "testing FIFO..."
mkfifo test.fifo mkfifo test.fifo
if [ ! -p test.fifo ] ; then if [ ! -p test.fifo ] ; then
echo could not create fifo echo could not create fifo
exit 1 exit 1
fi fi
testremove test.fifo testremove test.fifo
# hard links # hard links
echo
echo "testing hard links..."
echo "the hard link" > test.file echo "the hard link" > test.file
cp -f test.file test2.file cp -f test.file test2.file
ln test.file test3.file ln test.file test3.file
if ! cmp test.file test3.file ; then if ! cmp test.file test3.file ; then
echo "compare of test.file and test3.file failed on hard link test" echo "compare of test.file and test3.file failed on hard link test"
exit 1 exit 1
fi fi
testremove test3.file testremove test3.file
if ! cmp test.file test2.file ; then if ! cmp test.file test2.file ; then
echo "compare of test.file and test2.file failed on hard link test" echo "compare of test.file and test2.file failed on hard link test"
skipping to change at line 124 skipping to change at line 150
exit 1 exit 1
fi fi
testremove test.file testremove test.file
if [ -f test.file ] ; then if [ -f test.file ] ; then
echo could not remove test file echo could not remove test file
exit 1 exit 1
fi fi
# test directory symlink # test directory symlink
echo
echo "testing directory symlinks..."
mkdir test.dir mkdir test.dir
cd test.dir cd test.dir
echo test > test.file echo test > test.file
ln -s test.file test.link ln -s test.file test.link
mkdir -p /tmp/doj mkdir -p /tmp/doj
echo test2 > /tmp/doj/test.file2 echo test2 > /tmp/doj/test.file2
ln -s /tmp/doj doj ln -s /tmp/doj doj
cd .. cd ..
testremove test.dir testremove test.dir
if [ ! -f /tmp/doj/test.file2 ] ; then if [ ! -f /tmp/doj/test.file2 ] ; then
skipping to change at line 150 skipping to change at line 178
cp -f /etc/fstab "/tmp/$USER.fstab" cp -f /etc/fstab "/tmp/$USER.fstab"
set +e set +e
if $SRM -f /etc/fstab ; then if $SRM -f /etc/fstab ; then
echo "removing /etc/fstab as user should not work" echo "removing /etc/fstab as user should not work"
exit 1 exit 1
fi fi
set -e set -e
fi fi
# test extended attributes # test extended attributes
if [ 1 = 2 ] ; then
echo
echo "test extended attributes..."
DIR=test.test DIR=test.test
mkdir -p $DIR mkdir -p $DIR
chmod +t $DIR chmod +t $DIR
FN=$DIR/test.atr FN=$DIR/test.atr
echo "TEST" > $FN echo "TEST" > $FN
OS=$(uname -s) OS=$(uname -s)
if [ "$OS" = Linux ] ; then if [ "$OS" = Linux ] ; then
setfattr -n user.a1 -v "The value of extended attribute number 1" $FN setfattr -n user.a1 -v "The value of extended attribute number 1" $FN
setfattr -n user.num2 -v "A second attribute." $FN setfattr -n user.num2 -v "A second attribute." $FN
elif [ "$OS" = FreeBSD ] ; then elif [ "$OS" = FreeBSD ] ; then
setextattr user a1 "The value of extended attribute number 1" $FN setextattr user a1 "The value of extended attribute number 1" $FN
setextattr user num2 "A second attribute." $FN setextattr user num2 "A second attribute." $FN
elif [ "$OS" = Darwin ] ; then elif [ "$OS" = Darwin ] ; then
xattr -w a1 "The value of extended attribute number 1" $FN xattr -w a1 "The value of extended attribute number 1" $FN
xattr -w num2 "A second attribute." $FN xattr -w num2 "A second attribute." $FN
fi fi
$SRM $FN $SRM $FN
rmdir $DIR rmdir $DIR
fi
# test file sizes # test file sizes
BS=123 BS=123
SRC=/dev/zero # /dev/urandom SRC=/dev/zero # /dev/urandom
if [ ! -c $SRC ] ; then if [ ! -c $SRC ] ; then
echo $SRC not present or no char device echo $SRC not present or no char device
exit 1 exit 1
fi fi
testsrm() testsrm()
{ {
if [ ! -f $F ] ; then if [ ! -f $F ] ; then
echo failed to create $F echo failed to create $F
exit 1 exit 1
fi fi
ls -l $F
if ! $SRM $F ; then if ! $SRM $F ; then
echo failed to secure remove $F echo failed to secure remove $F
exit 1 exit 1
fi fi
if [ -f $F ] ; then if [ -f $F ] ; then
echo srm was not able to remove $F echo srm was not able to remove $F
exit 1 exit 1
fi fi
} }
F="0.tst" F="0.tst"
touch $F touch $F
testsrm testsrm
# test until ~5GiB # test until ~5GiB
for i in 1 22 333 4444 55555 666666 7777777 44444444 for i in 1 22 333 4444 55555 666666 7777777 44444444
do do
echo
echo
echo "test file of $(($i * $BS / 1024)) KB..."
F="$i.tst" F="$i.tst"
dd if=$SRC of=$F bs=$BS count=$i 2> /dev/null dd if=$SRC of=$F bs=$BS count=$i 2> /dev/null
testsrm testsrm
done done
echo all tests successful echo "all tests successful."
exit 0 exit 0
 End of changes. 14 change blocks. 
4 lines changed or deleted 38 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS