Debian Codegraph @

tests/020_test_lchown.sh

raw symbols SCIP
1 #!/bin/bash
2 # test chown function handling.
3 set -ex
4
5 TESTDIR=$(mktemp -d )
6 set -- $(id -G)
7
8 # assumes that this user has multiple groups.
9 ORIGID=$1
10 NEWID=$2
11
12 if (( $# < 3 )); then
13 echo "W: Needs multiple groups for user $(id) for this test to succeed, test skipped"
14 exit 77
15 fi
16
17 cd ${TESTDIR}
18 mkdir 1/
19
20 # make a few files for testing.
21 touch 1/a 1/b 1/c 1/d
22 ln -s a 1/f
23 ln -s b 1/g
24
25 dd if=/dev/zero of=1/e bs=512 count=2
26 chgrp $ORIGID 1/a 1/b 1/c 1/d
27 ls -li 1/ > ls.prev
28
29 sleep 1s
30
31 cp -al 1/ 2
32
33 echo " 2/ before"
34 ls -li 2/
35 cow-shell 012_test_chown $NEWID 2/f 2/b 2/g
36 echo " 2/ after"
37 ls -li 2/
38
39 rm -rf 2/
40
41 ls -li 1/ > ls.after
42
43
44
45 echo " 1/ differences; should not exist"
46 diff -u ls.prev ls.after
47
48 rm -rf ${TESTDIR}