maint: correct © dates for hardware optimized crc routines
[coreutils.git] / tests / install / install-C-root.sh
blobba51df9062192f40c434a2e5754b4a124d933cbc
1 #!/bin/sh
2 # Ensure "install -C" compares owner and group.
4 # Copyright (C) 2008-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ ginstall
21 require_root_
22 skip_if_setgid_
23 skip_if_nondefault_group_
25 u1=1
26 u2=2
27 g1=1
28 g2=2
31 echo test > a || framework_failure_
32 echo "'a' -> 'b'" > out_installed_first
33 echo "removed 'b'
34 'a' -> 'b'" > out_installed_second
35 > out_empty
37 # destination file does not exist
38 ginstall -Cv -o$u1 -g$g1 a b > out || fail=1
39 compare out out_installed_first || fail=1
41 # destination file exists
42 ginstall -Cv -o$u1 -g$g1 a b > out || fail=1
43 compare out out_empty || fail=1
45 # destination file exists but -C is not given
46 ginstall -v -o$u1 -g$g1 a b > out || fail=1
47 compare out out_installed_second || fail=1
49 # destination file exists but owner differs
50 ginstall -Cv -o$u2 -g$g1 a b > out || fail=1
51 compare out out_installed_second || fail=1
52 ginstall -Cv -o$u2 -g$g1 a b > out || fail=1
53 compare out out_empty || fail=1
55 # destination file exists but group differs
56 ginstall -Cv -o$u2 -g$g2 a b > out || fail=1
57 compare out out_installed_second || fail=1
58 ginstall -Cv -o$u2 -g$g2 a b > out || fail=1
59 compare out out_empty || fail=1
61 # destination file exists but owner differs from getuid ()
62 ginstall -Cv -o$u2 a b > out || fail=1
63 compare out out_installed_second || fail=1
64 ginstall -Cv a b > out || fail=1
65 compare out out_installed_second || fail=1
66 ginstall -Cv a b > out || fail=1
67 compare out out_empty || fail=1
69 # destination file exists but group differs from getgid ()
70 ginstall -Cv -g$g2 a b > out || fail=1
71 compare out out_installed_second || fail=1
72 ginstall -Cv a b > out || fail=1
73 compare out out_installed_second || fail=1
74 ginstall -Cv a b > out || fail=1
75 compare out out_empty || fail=1
77 Exit $fail