bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ls bug?


From: hooanon05
Subject: ls bug?
Date: Sun, 27 May 2007 11:27:09 +0900

Hello,

First of all, I appricate your great works.
Today I've found strange behaviour in ls(1). While it is expected to
return an error silently, it prints bogus information. Here is a simple
script to reproduce it.

Note:
- v5.2.1 returns an error and prints nothing to stdout.
- v5.97 returns a success and prints garbage to stdout.
- v6.9+ returns an error and prints garbage to stdout.


Junjiro Okajima


----------------------------------------------------------------------
#!/bin/sh

set -x
cd /tmp
mkdir a
touch a/b
ls -l a
chmod a-x a
sudo ls -al a
for i in /tmp/ls /bin/ls /tmp/src/coreutils/src/ls
do
        $i --version | head -1
        $i -al a
        echo status is $?
done
----------------------------------------------------------------------

(the output)

$ sudo rm -r /tmp/a && sh /tmp/a.sh
+ cd /tmp
+ mkdir a
+ touch a/b
+ ls -l a
total 0
-rw-r--r-- 1 jro jro 0 May 27 11:21 b
+ chmod a-x a
+ sudo ls -al a
total 505
drw-r--r-- 2 jro  jro    1024 May 27 11:21 .
drwxrwxrwt 9 root root 513024 May 27 11:21 ..
-rw-r--r-- 1 jro  jro       0 May 27 11:21 b
+ /tmp/ls --version
+ head -1
ls (coreutils) 5.2.1
+ /tmp/ls -al a
/tmp/ls: a/.: Permission denied
/tmp/ls: a/..: Permission denied
/tmp/ls: a/b: Permission denied
total 0
+ echo status is 1
status is 1
+ /bin/ls --version
+ head -1
ls (GNU coreutils) 5.97
+ /bin/ls -al a
total 0
?--------- ? ? ? ?            ? a/.
?--------- ? ? ? ?            ? a/..
?--------- ? ? ? ?            ? a/b
+ echo status is 0
status is 0
+ /tmp/src/coreutils/src/ls --version
+ head -1
ls (GNU coreutils) 6.9+
+ /tmp/src/coreutils/src/ls -al a
/tmp/src/coreutils/src/ls: cannot access a/.: Permission denied
/tmp/src/coreutils/src/ls: cannot access a/..: Permission denied
/tmp/src/coreutils/src/ls: cannot access a/b: Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
-????????? ? ? ? ?            ? b
+ echo status is 1
status is 1
$ 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]