File: 030_eperm_warn

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 (77 lines) | stat: -rwxr-xr-x 1,450 bytes parent folder | download | duplicates (4)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash

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

if [[ "$UID" -eq 0 ]]
then
  # If we simply changed to another uid (eg. via perl $< = $> = 1),
	# how could we be sure that all needed areas (wc, wc2, repos, ...)
	# are writeable by that other user?
	# Currently only test if non-root.
	$WARN "Test for EPERM-warnings not done for UID 0."
	exit
fi


file=file

touch $file
$BINq ci -m "x"


# Now change owner/group
# Sadly svn won't do "svn ps file://...."
svn co $REPURL tmp/
for prop in svn:owner svn:group
do
	old=`svn pg $prop tmp/$file`
	new=`perl -e 'print shift() ^ 1' $old`
	svn ps $prop $new tmp/$file
done
svn ci -m "x" tmp
rm -rf tmp


logfile=$LOGDIR/030.logfile


# We test with stop first, as with a simple warning the file could
# checked out and the next update would have nothing to do.
# Now we get an error:
echo "Testing stopping"
if $BINdflt -v up -W chown-eperm=stop > $logfile 2>&1
then
	cat $logfile
	$ERROR "not stopped!"
else
	if [[ `grep chown-eperm $logfile | wc -l` -eq 1 ]]
	then
		$SUCCESS "stopped."
	else
		cat $logfile
		$ERROR "stopped for wrong reason?"
	fi
fi


# We get a warning:
echo "Testing warning"
$BINdflt up -v > $logfile 2>&1 
# && $ERROR "no exit status!"
# should a warning give an exit status?
if [[ `grep chown-eperm $logfile | wc -l` -ge 1 ]]
then
	$SUCCESS "warning given"
else
	cat $logfile
	$ERROR "warning NOT given"
fi


rm $logfile

$WC2_UP_ST_COMPARE > /dev/null 2>&1