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