2006-07-25 15:23:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Verify that ls works properly when it fails to stat a file that is
|
|
|
|
|
# not mentioned on the command line.
|
|
|
|
|
|
2023-01-01 14:50:15 +00:00
|
|
|
# Copyright (C) 2006-2023 Free Software Foundation, Inc.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2007-07-23 14:35:58 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2006-08-17 19:58:17 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 14:35:58 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2006-08-17 19:58:17 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2017-09-19 01:13:23 -07:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2012-09-02 21:55:12 +02:00
|
|
|
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
2010-11-17 21:35:31 +01:00
|
|
|
print_ver_ ls
|
2007-09-12 14:52:26 +02:00
|
|
|
skip_if_root_
|
2006-07-25 15:23:59 +00:00
|
|
|
|
2015-01-13 03:30:33 +00:00
|
|
|
LS_MINOR_PROBLEM=1
|
|
|
|
|
|
2011-08-04 20:52:31 +02:00
|
|
|
mkdir d || framework_failure_
|
|
|
|
|
ln -s / d/s || framework_failure_
|
|
|
|
|
chmod 600 d || framework_failure_
|
2006-07-25 15:23:59 +00:00
|
|
|
|
|
|
|
|
|
2016-11-08 19:57:41 -06:00
|
|
|
returns_ 1 ls -Log d > out || fail=1
|
2006-07-25 15:23:59 +00:00
|
|
|
|
2015-11-21 10:59:37 +00:00
|
|
|
# Linux 2.6.32 client with Isilon OneFS always returns d_type==DT_DIR ('d')
|
|
|
|
|
# Newer Linux 3.10.0 returns the more correct DT_UNKNOWN ('?')
|
|
|
|
|
grep '^[l?]?' out || skip_ 'unrecognized d_type returned'
|
|
|
|
|
|
|
|
|
|
cat <<\EOF > exp || framework_failure_
|
2006-07-25 15:30:27 +00:00
|
|
|
total 0
|
2006-07-26 14:35:19 +00:00
|
|
|
?????????? ? ? ? s
|
2006-07-25 15:30:27 +00:00
|
|
|
EOF
|
|
|
|
|
|
2011-11-22 10:08:04 +01:00
|
|
|
sed 's/^l/?/' out | compare exp - || fail=1
|
2006-07-25 15:30:27 +00:00
|
|
|
|
|
|
|
|
# Ensure that the offsets in --dired output are accurate.
|
|
|
|
|
rm -f out exp
|
2015-01-13 03:30:33 +00:00
|
|
|
returns_ $LS_MINOR_PROBLEM ls --dired -l d > out || fail=1
|
2006-07-25 15:30:27 +00:00
|
|
|
|
2015-11-21 10:59:37 +00:00
|
|
|
cat <<\EOF > exp || framework_failure_
|
2006-07-25 15:30:27 +00:00
|
|
|
total 0
|
2006-07-26 14:35:19 +00:00
|
|
|
?????????? ? ? ? ? ? s
|
|
|
|
|
//DIRED// 44 45
|
2006-07-25 15:30:27 +00:00
|
|
|
//DIRED-OPTIONS// --quoting-style=literal
|
|
|
|
|
EOF
|
|
|
|
|
|
2011-11-22 10:08:04 +01:00
|
|
|
sed 's/^ l/ ?/' out | compare exp - || fail=1
|
2006-07-25 15:30:27 +00:00
|
|
|
|
2008-09-07 10:31:27 +02:00
|
|
|
Exit $fail
|