[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug 984910] rm fails to detect errors in readdir(3)
From: |
Pádraig Brady |
Subject: |
Re: [Bug 984910] rm fails to detect errors in readdir(3) |
Date: |
Wed, 22 Jun 2016 12:00:23 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 21/06/16 19:58, Bernhard Voelker wrote:
> forwarding to gnulib.
>
> Have a nice day,
> Berny
>
>
> -------- Forwarded Message --------
> Subject: [Bug 984910] rm fails to detect errors in readdir(3)
> Date: Wed, 15 Jun 2016 19:26:24 +0000
> From: address@hidden
>
> Andreas Stieger changed bug 984910
> <http://bugzilla.opensuse.org/show_bug.cgi?id=984910>
>
> --------------------------------------
> openSUSE bug report by: Peter Benie <address@hidden>
>
>
> rm, and anything else in coreutils using the fts functions, fails to
> detect errors in readdir(3). Thankfully such errors are rare, but an
> example of where they can occur is where a NFS server has a poor readdir
> cookie implementation.
>
> The very latest upsteam coreutils uses the fts functions that are built
> into libc. In OpenSuSE 13.2 it uses its own copy of fts.
>
> The error is in lib/fts.c:fts_read(), which calls readdir() without
> correctly checking the error return. readdir returns NULL on end-of-directory
> or on error; fts_read assumes that NULL always means end-of-directory.
That looks like a valid issue.
However don't we want to restrict this to only when errno!=0 ?
Also if setting FTS_DNR it could be inconsistent to return dir entries also?
Also fts_info may be set to FTS_DP if !nitems?
Also I'm not sure we need to save errno in this case.
How about the attached instead?
thanks!
Pádraig
gnulib-readdir-error.patch
Description: Text Data
Re: [Bug 984910] rm fails to detect errors in readdir(3), Pádraig Brady, 2016/06/22