File: 068_symlinks

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (53 lines) | stat: -rwxr-xr-x 850 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

set -e 
$PREPARE_CLEAN > /dev/null
$INCLUDE_FUNCS

cd $WC


logfile=$LOGDIR/068.symlinks


mkdir dirA dirB

date > dirA/entryA
echo A > dirA/file

date > dirB/entryB
echo BB > dirB/file

for dest in A B
do
	$INFO "Destination of links now $dest"
	ln -s dir$dest sl
	ln -s $WC/dir$dest sllong

	$BINq ci -m1

	echo $RANDOM >> dir$dest/entry$dest
	$BINdflt st
	for lnk in sl sllong
	do
		$INFO "going by link $lnk"
		for p in "" "/." "/././////." "/*" "/entry$dest" "////entry$dest"
		do
			$BINdflt st $lnk/$p > $logfile
			if [[ `wc -l < $logfile` -ne 1 ]]
			then
				cat $logfile
				$ERROR "Wrong number of lines, wanted exactly one line."
			fi
			if grep "/entry$dest"'$' $logfile
			then
				$SUCCESS "Correct result in $lnk/$p"
			else
				cat $logfile
				$ERROR "Wrong result for $lnk/$p"
			fi
		done
	done

	rm sl sllong
done