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.
|
|
|
|
|
|
2009-06-23 22:33:15 +02:00
|
|
|
# Copyright (C) 2006-2009 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
|
2007-07-23 14:35:58 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2006-07-25 15:23:59 +00:00
|
|
|
if test "$VERBOSE" = yes; then
|
|
|
|
|
set -x
|
|
|
|
|
ls --version
|
|
|
|
|
fi
|
|
|
|
|
|
2008-05-27 13:45:44 +02:00
|
|
|
. $srcdir/test-lib.sh
|
2007-09-12 14:52:26 +02:00
|
|
|
skip_if_root_
|
2006-07-25 15:23:59 +00:00
|
|
|
|
2007-09-08 10:09:19 +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
|
|
|
|
|
|
|
|
fail=0
|
|
|
|
|
|
2008-10-28 09:24:01 +01:00
|
|
|
ls -Log d > out
|
2006-07-25 15:23:59 +00:00
|
|
|
test $? = 1 || fail=1
|
|
|
|
|
|
2006-07-25 15:30:27 +00:00
|
|
|
cat <<\EOF > exp || fail=1
|
|
|
|
|
total 0
|
2006-07-26 14:35:19 +00:00
|
|
|
?????????? ? ? ? s
|
2006-07-25 15:30:27 +00:00
|
|
|
EOF
|
|
|
|
|
|
2007-09-08 10:09:19 +02: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
|
2008-10-28 09:24:01 +01:00
|
|
|
ls --dired -l d > out && fail=1
|
2006-07-25 15:30:27 +00:00
|
|
|
|
|
|
|
|
cat <<\EOF > exp || fail=1
|
|
|
|
|
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
|
|
|
|
|
|
2007-09-08 10:09:19 +02: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
|