GNU bug report logs -
#44587
ls prints garbage when listing contents of a directory without exec permissions
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44587 in the body.
You can then email your comments to 44587 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#44587
; Package
coreutils
.
(Wed, 11 Nov 2020 23:27:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jan Schaumann <jschauma <at> netmeister.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 11 Nov 2020 23:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When running 'ls -l' on a directory that the user does
not have execute permissions on, ls(1) still attempts
to generate the long listing and prints the various
fields with garbage:
$ mkdir dir
$ touch dir/file
$ chmod a-x dir
$ ls -ld dir
drw-r--r-- 2 jschauma users 28 Nov 11 23:15 dir
$ ls -la dir
ls: cannot access dir/.: Permission denied
ls: cannot access dir/..: Permission denied
ls: cannot access dir/file: Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? file
$
Expected output:
$ ls -la dir
ls: cannot access dir/.: Permission denied
ls: cannot access dir/..: Permission denied
ls: cannot access dir/file: Permission denied
$
This is coreutils-8.32.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#44587
; Package
coreutils
.
(Wed, 11 Nov 2020 23:54:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 44587 <at> debbugs.gnu.org (full text, mbox):
On 11/12/20 12:24 AM, Jan Schaumann wrote:
> When running 'ls -l' on a directory that the user does
> not have execute permissions on, ls(1) still attempts
> to generate the long listing and prints the various
> fields with garbage:
>
> $ mkdir dir
> $ touch dir/file
> $ chmod a-x dir
> $ ls -ld dir
> drw-r--r-- 2 jschauma users 28 Nov 11 23:15 dir
> $ ls -la dir
> ls: cannot access dir/.: Permission denied
> ls: cannot access dir/..: Permission denied
> ls: cannot access dir/file: Permission denied
> total 0
> d????????? ? ? ? ? ? .
> d????????? ? ? ? ? ? ..
> -????????? ? ? ? ? ? file
> $
>
>
> Expected output:
>
> $ ls -la dir
> ls: cannot access dir/.: Permission denied
> ls: cannot access dir/..: Permission denied
> ls: cannot access dir/file: Permission denied
> $
>
> This is coreutils-8.32.
That feature seems to have been turned on explicitly in version 6.0 (in 2006):
https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=ccb1883fcd2
[...] Apply the stat-failed parts of Red Hat's
coreutils-selinux.patch. From Ulrich Drepper.
This makes it so files not mentioned on the command line (e.g.,
names read from a directory that *is* mentioned on the command
line) for which stat fails are still listed. [...]
Have a nice day,
Berny
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Thu, 12 Nov 2020 03:42:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jan Schaumann <jschauma <at> netmeister.org>
:
bug acknowledged by developer.
(Thu, 12 Nov 2020 03:42:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 44587-done <at> debbugs.gnu.org (full text, mbox):
On 11/11/20 3:24 PM, Jan Schaumann wrote:
> $ ls -la dir
> ls: cannot access dir/.: Permission denied
> ls: cannot access dir/..: Permission denied
> ls: cannot access dir/file: Permission denied
> total 0
> d????????? ? ? ? ? ? .
> d????????? ? ? ? ? ? ..
> -????????? ? ? ? ? ? file
> $
>
>
> Expected output:
>
> $ ls -la dir
> ls: cannot access dir/.: Permission denied
> ls: cannot access dir/..: Permission denied
> ls: cannot access dir/file: Permission denied
As Bernhard mentioned, the actual output is intentional. The expected output
would be less useful, as it would give the user a bit less information (e.g., it
would not tell the user where 'file' is a regular file or a directory).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 10 Dec 2020 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 271 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.