1#!/bin/sh 2# 3# $FreeBSD$ 4# 5# Tests vfs_lookup()'s handling of trailing slashes for symlinks that 6# point to files. See kern/21768 for details. Fixed in r193028. 7# 8 9testfile="/tmp/testfile-$$" 10testlink="/tmp/testlink-$$" 11 12tests=" 13$testfile:$testlink:$testfile:0 14$testfile:$testlink:$testfile/:1 15$testfile:$testlink:$testlink:0 16$testfile:$testlink:$testlink/:1 17$testfile/:$testlink:$testlink:1 18$testfile/:$testlink:$testlink/:1 19" 20 21touch $testfile || exit 1 22trap "rm $testfile $testlink" EXIT 23 24set $tests 25echo "1..$#" 26n=1 27for testspec ; do 28 ( 29 IFS=: 30 set $testspec 31 unset IFS 32 ln -fs "$1" "$2" || exit 1 33 cat "$3" >/dev/null 2>&1 34 ret=$? 35 if [ "$ret" -eq "$4" ] ; then 36 echo "ok $n" 37 else 38 echo "fail $n - expected $4, got $ret" 39 fi 40 ) 41 n=$((n+1)) 42done 43