File: 067_readonly_repo

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 (44 lines) | stat: -rwxr-xr-x 655 bytes parent folder | download
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
#!/bin/bash

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

TMP=$LOGDIR/067.msg

date > blabla
chmod 765 tree/c


function ER
{
	msg=$1
	shift
	if $@ &> $TMP
	then
		$ERROR "Shouldn't succeed."
	else
		echo "Got an error:"
		cat $TMP
		if grep -F "$msg" $TMP
		then
			$SUCCESS "correct message."
		else
			$ERROR "wrong message"
		fi
	fi
}


$INFO "ci to inaccessible dir"
# chmod goes top-down, which doesn't work with removing rights.
find $REP -depth | xargs chmod 000
ER "Couldn't open a repository (180001)" $BINq ci -m "RO"

$INFO "ci to readonly dir"
chmod -R 555 $REP
ER "Permission denied (13)" $BINq ci -m "RO"

chmod -R 777 $REP