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

« back to all changes in this revision

Viewing changes to tests/rm/fail-eacces.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
# Ensure that rm -rf unremovable-non-dir gives a diagnostic.
 
3
# Test both a regular file and a symlink -- it makes a difference to rm.
 
4
# With the symlink, rm from coreutils-6.9 would fail with a misleading
 
5
# ELOOP diagnostic.
 
6
 
 
7
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
8
 
 
9
# This program is free software: you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation, either version 3 of the License, or
 
12
# (at your option) any later version.
 
13
 
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
 
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
 
 
22
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 
23
print_ver_ rm
 
24
skip_if_root_
 
25
 
 
26
ok=0
 
27
mkdir d           &&
 
28
  touch d/f       &&
 
29
  ln -s f d/slink &&
 
30
  chmod a-w d     &&
 
31
  ok=1
 
32
test $ok = 1 || framework_failure_
 
33
 
 
34
mkdir e           &&
 
35
  ln -s f e/slink &&
 
36
  chmod a-w e     &&
 
37
  ok=1
 
38
test $ok = 1 || framework_failure_
 
39
 
 
40
 
 
41
rm -rf d/f 2> out && fail=1
 
42
cat <<\EOF > exp
 
43
rm: cannot remove 'd/f': Permission denied
 
44
EOF
 
45
compare exp out || fail=1
 
46
 
 
47
# This used to fail with ELOOP.
 
48
rm -rf e 2> out && fail=1
 
49
cat <<\EOF > exp
 
50
rm: cannot remove 'e/slink': Permission denied
 
51
EOF
 
52
compare exp out || fail=1
 
53
 
 
54
Exit $fail