Subject: bug#44587: closed (Re: bug#44587: ls prints garbage when listing contents of a directory without exec permissions)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 12 Nov 2020 03:42:02 +0000

Your bug report

#44587: ls prints garbage when listing contents of a directory without exec permissions

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
44587: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44587
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#44587: ls prints garbage when listing contents of a directory without exec permissions
From: Paul Eggert <[email-masked]>
To: Jan Schaumann <[email-masked]>
Cc: [email-masked]
Date: Wed, 11 Nov 2020 19:41:08 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

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).

Subject: ls prints garbage when listing contents of a directory without exec permissions
From: Jan Schaumann <[email-masked]>
To: [email-masked]
Date: Wed, 11 Nov 2020 18:24:17 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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.