GNU bug report logs - #43497
ls exit status on removed directory

Previous Next

Package: coreutils;

Reported by: "Philip Rowlands" <phr+coreutils <at> dimebar.com>

Date: Fri, 18 Sep 2020 23:17:02 UTC

Severity: normal

Full log


Message #8 received at 43497 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Philip Rowlands <phr+coreutils <at> dimebar.com>, 43497 <at> debbugs.gnu.org
Subject: Re: bug#43497: ls exit status on removed directory
Date: Sat, 19 Sep 2020 13:50:33 +0100
On 19/09/2020 00:15, Philip Rowlands wrote:
> Steps to reproduce:
> 
> $ mkdir /tmp/abc
> $ cd /tmp/abc
> $ rmdir /tmp/abc
> $ ls
> 
> What happened:
> no output, successful exit status
> 
> What was expected:
> no output, unsuccessful exit status
> 
> ls tried to list the contents of . but failed to do so, at least on Linux:
> open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
> getdents(3, 0x55e10c419cf0, 32768)      = -1 ENOENT (No such file or directory)
> 
> Although "stat ." and "ls -ld ." still work on the removed directory, should "ls ." report success even though the getdents syscall fails?

What you expect was released as part of v8.32:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.31-88-g05a99f7d7
though current trunk (and Fedora at least), have reverted to the original behavior:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.32-2-g10fcb97bd

cheers,
Pádraig




This bug report was last modified 4 years and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.