aboutsummaryrefslogtreecommitdiffstats
path: root/test/test-cp-setuid.sh
blob: 0759608c3ee0268b9bceadc28688b7ae737f6936 (plain)
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
#!/bin/bash
#
# SPDX-License-Identifier: LGPL-2.1-only
#
set -e

# Verify that special bits (setuid/setgid/sticky) are preserved.
#
# Return vals:
#
#                 2 - Incorrect permissions
# All other nonzero - Unexpected command error
#                 0 - Pass

trap "rm -rf d1 d2" EXIT

mkdir d1
chmod 7777 d1
cp -Rp d1 d2
perms=`ls -od d1 d2 | cut -c 1-10 | uniq`
if [ "$perms" != drwsrwsrwt ]; then
	exit 2
fi


exit 0