2 # Prior to coreutils-6.5, an inaccessible destination dir (chmod a-x)
3 # would cause du to exit prematurely on systems with native openat support.
5 # Copyright (C) 2006-2024 Free Software Foundation, Inc.
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.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
24 mkdir f
&& cd f
&& mkdir a b c d e
&& touch c
/j
&& chmod a-x c \
27 du
> ..
/t
2>&1 && fail
=1
29 # Accept either of the following outputs.
30 # You get the first from a system with openat _emulation_ (via /proc),
31 # the second from a system with native openat support.
32 # FIXME: there may well be a third output, for systems with neither
33 # /proc support, nor native openat support.
35 sed 's/^[0-9][0-9]* //' ..
/t |
sort -u > out
36 cat <<\EOF
> exp || framework_failure_
43 du
: cannot
read directory
'./c': Permission denied
46 # Map a diagnostic like this
47 # du: cannot access './c/j': Permission denied
49 # du: cannot access './c': Permission denied
50 # And accept "cannot read directory" in place of "cannot access"
51 sed "s,/c/j': ,/c': ," out
> t
&& mv t out
52 sed 's,cannot access,cannot read directory,' out
> t
&& mv t out
54 compare exp out || fail
=1