3 # Test that we don't follow symlinks when writing to .augnew
5 ROOT=$abs_top_builddir/build/test-put-symlink-augnew
6 LENSES=$abs_top_srcdir/lenses
9 HOSTS_AUGNEW=${HOSTS}.augnew
11 ATTACK_FILE=$ROOT/other/attack
14 mkdir -p $(dirname $HOSTS)
15 mkdir -p $(dirname $ATTACK_FILE)
22 (cd $(dirname $HOSTS) && ln -s ../other/attack $(basename $HOSTS).augnew)
24 HOSTS_SUM=$(sum $HOSTS)
26 augtool --nostdinc -I $LENSES -r $ROOT --new > /dev/null <<EOF
27 set /files/etc/hosts/1/alias myhost
31 if [ ! -f $HOSTS -o -h $HOSTS ] ; then
32 echo "/etc/hosts is no longer a regular file"
35 if [ ! "x${HOSTS_SUM}" = "x$(sum $HOSTS)" ]; then
36 echo "/etc/hosts has changed"
40 if [ -h $HOSTS_AUGNEW ] ; then
41 echo "/etc/hosts.augnew is still a symlink, should be unlinked"
44 if ! grep myhost $HOSTS_AUGNEW >/dev/null; then
45 echo "/etc/hosts does not contain the modification"
49 if [ -s $ATTACK_FILE ]; then
50 echo "/other/attack now contains data, should be blank"