]> Dogcows Code - chaz/tar/blob - tests/ignfail.sh
Updated
[chaz/tar] / tests / ignfail.sh
1 #! /bin/sh
2 # This file is part of GNU tar testsuite.
3 # Copyright (C) 2004 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19
20 # Unreadable directories yielded error despite --ignore-failed-read.
21
22 . ./preset
23 . $srcdir/before
24
25 > check-uid
26 set - x`ls -l check-uid`
27 uid_name="$3"
28 set - x`ls -ln check-uid`
29 uid_number="$3"
30 if test "$uid_name" = root || test "$uid_number" = 0; then
31
32 # The test is meaningless for super-user.
33 rm check-uid
34
35 else
36
37 touch file
38 mkdir directory
39 touch directory/file
40
41 echo 1>&2 -----
42 chmod 000 file
43 tar cf archive file
44 status=$?
45 chmod 600 file
46 test $status = 2 || exit 1
47
48 echo 1>&2 -----
49 chmod 000 file
50 tar cf archive --ignore-failed-read file || exit 1
51 status=$?
52 chmod 600 file
53 test $status = 0 || exit 1
54
55 echo 1>&2 -----
56 chmod 000 directory
57 tar cf archive directory
58 status=$?
59 chmod 700 directory
60 test $status = 2 || exit 1
61
62 echo 1>&2 -----
63 chmod 000 directory
64 tar cf archive --ignore-failed-read directory || exit 1
65 status=$?
66 chmod 700 directory
67 test $status = 0 || exit 1
68
69 err="\
70 -----
71 tar: file: Cannot open: Permission denied
72 tar: Error exit delayed from previous errors
73 -----
74 tar: file: Warning: Cannot open: Permission denied
75 -----
76 tar: directory: Cannot savedir: Permission denied
77 tar: Error exit delayed from previous errors
78 -----
79 tar: directory: Warning: Cannot savedir: Permission denied
80 "
81
82 fi
83
84 . $srcdir/after
This page took 0.034341 seconds and 4 git commands to generate.