2 # SPDX-License-Identifier: LGPL-2.1-or-later
6 # Make sure that the "stat" output is not locale dependent.
9 # first, create file without suid/sgid
10 systemd-tmpfiles
--create - <<EOF
11 f /tmp/xxx 0755 1 1 - -
12 f /tmp/yyy 0755 1 1 - -
15 test "$(stat -c %F:%u:%g:%a /tmp/xxx)" = "regular empty file:1:1:755"
16 test "$(stat -c %F:%u:%g:%a /tmp/yyy)" = "regular empty file:1:1:755"
19 systemd-tmpfiles
--create - <<EOF
24 test "$(stat -c %F:%u:%g:%a /tmp/xxx)" = "regular empty file:1:1:4755"
25 test "$(stat -c %F:%u:%g:%a /tmp/yyy)" = "regular empty file:1:1:2755"
27 # then, chown the files to somebody else
28 systemd-tmpfiles
--create - <<EOF
33 test "$(stat -c %F:%u:%g:%a /tmp/xxx)" = "regular empty file:2:2:4755"
34 test "$(stat -c %F:%u:%g:%a /tmp/yyy)" = "regular empty file:2:2:2755"
36 # then, chown the files to a third user/group but also drop to a mask that has
37 # both more and fewer bits set
38 systemd-tmpfiles
--create - <<EOF
43 test "$(stat -c %F:%u:%g:%a /tmp/xxx)" = "regular empty file:3:3:770"
44 test "$(stat -c %F:%u:%g:%a /tmp/yyy)" = "regular empty file:3:3:770"
46 # return to the beginning
47 systemd-tmpfiles
--create - <<EOF
48 f /tmp/xxx 0755 1 1 - -
49 f /tmp/yyy 0755 1 1 - -
52 test "$(stat -c %F:%u:%g:%a /tmp/xxx)" = "regular empty file:1:1:755"
53 test "$(stat -c %F:%u:%g:%a /tmp/yyy)" = "regular empty file:1:1:755"
56 systemd-tmpfiles
--remove - <<EOF