maint: list Gnulib sys_types directly
[coreutils.git] / tests / ls / removed-directory.sh
blob291d77ee314ecb36d971feafec9b529bf5c3b5a6
1 #!/bin/sh
2 # If ls is asked to list a removed directory (e.g., the parent process's
3 # current working directory has been removed by another process), it
4 # should not emit an error message merely because the directory is removed.
6 # Copyright (C) 2020-2024 Free Software Foundation, Inc.
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 3 of the License, or
11 # (at your option) any later version.
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.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
22 print_ver_ ls
24 cwd=$(pwd)
25 mkdir d || framework_failure_
26 cd d || framework_failure_
27 rmdir ../d || skip_ "can't remove working directory on this platform"
29 # On NFS, 'ls' would run into the error "Stale file handle".
30 test -d . || skip_ "can't examine removed working directory on this platform"
32 ls >"$cwd"/out 2>"$cwd"/err || fail=1
33 cd "$cwd" || framework_failure_
35 compare /dev/null out || fail=1
36 compare /dev/null err || fail=1
38 Exit $fail