GNU bug report logs - #44587
ls prints garbage when listing contents of a directory without exec permissions

Previous Next

Package: coreutils;

Reported by: Jan Schaumann <jschauma <at> netmeister.org>

Date: Wed, 11 Nov 2020 23:27:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jan Schaumann <jschauma <at> netmeister.org>
Subject: bug#44587: closed (Re: bug#44587: ls prints garbage when listing
 contents of a directory without exec permissions)
Date: Thu, 12 Nov 2020 03:42:02 +0000
[Message part 1 (text/plain, inline)]
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 44587 <at> debbugs.gnu.org.

-- 
44587: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44587
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jan Schaumann <jschauma <at> netmeister.org>
Cc: 44587-done <at> debbugs.gnu.org
Subject: Re: bug#44587: ls prints garbage when listing contents of a directory
 without exec permissions
Date: Wed, 11 Nov 2020 19:41:08 -0800
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).

[Message part 3 (message/rfc822, inline)]
From: Jan Schaumann <jschauma <at> netmeister.org>
To: bug-coreutils <at> gnu.org
Subject: ls prints garbage when listing contents of a directory without exec
 permissions
Date: Wed, 11 Nov 2020 18:24:17 -0500
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.





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.