~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/mv/acl.sh

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# move files/directories across file system boundaries
 
3
# and make sure acls are preserved
 
4
 
 
5
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
 
6
 
 
7
# This program is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
 
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
 
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 
21
print_ver_ mv getfacl setfacl
 
22
 
 
23
require_acl_
 
24
 
 
25
# Skip this test if cp was built without ACL support:
 
26
grep '^#define USE_ACL 1' $CONFIG_HEADER > /dev/null ||
 
27
  skip_ "insufficient ACL support"
 
28
 
 
29
cleanup_() { rm -rf "$other_partition_tmpdir"; }
 
30
. "$abs_srcdir/tests/other-fs-tmpdir"
 
31
 
 
32
touch file || framework_failure_
 
33
t1=$other_partition_tmpdir/t1
 
34
touch $t1 || framework_failure_
 
35
 
 
36
skip_partition=none
 
37
# Ensure that setfacl and getfacl work on this file system.
 
38
setfacl -m user:bin:rw- file 2> /dev/null || skip_partition=.
 
39
# And on the destination file system.
 
40
setfacl -m user:bin:rw- $t1 || skip_partition=$other_partition_tmpdir
 
41
acl1=$(getfacl file) || skip_partition=.
 
42
 
 
43
test $skip_partition != none &&
 
44
  skip_ "'$skip_partition' is not on a suitable file system for this test"
 
45
 
 
46
# move the access acl of a file
 
47
mv file "$other_partition_tmpdir" || fail=1
 
48
acl2=$(cd "$other_partition_tmpdir" && getfacl file) || framework_failure_
 
49
test "$acl1" = "$acl2" || fail=1
 
50
 
 
51
# move the access acl of a directory
 
52
mkdir dir || framework_failure_
 
53
setfacl -m user:bin:rw- dir || framework_failure_
 
54
acl1=$(getfacl dir) || framework_failure_
 
55
mv dir "$other_partition_tmpdir" || fail=1
 
56
acl2=$(cd "$other_partition_tmpdir" && getfacl dir) || framework_failure_
 
57
test "$acl1" = "$acl2" || fail=1
 
58
 
 
59
# move the default acl of a directory
 
60
mkdir dir2 || framework_failure_
 
61
setfacl -d -m user:bin:rw- dir2 || framework_failure_
 
62
acl1=$(getfacl dir2) || framework_failure_
 
63
mv dir2 "$other_partition_tmpdir" || fail=1
 
64
acl2=$(cd "$other_partition_tmpdir" && getfacl dir2) || framework_failure_
 
65
test "$acl1" = "$acl2" || fail=1
 
66
 
 
67
Exit $fail