[HEADSUP] Disallowing read() of a directory fd

Joerg Sonnenberger joerg at bec.de
Fri May 15 23:09:33 UTC 2020


On Sat, May 16, 2020 at 12:47:24AM +0200, Steffen Nurpmeso wrote:
> Joerg Sonnenberger wrote in
> <20200515220923.GA36597 at bec.de>:
>  |On Fri, May 15, 2020 at 10:25:26PM +0200, Arne Steinkamm wrote:
>  |> On Fri, May 15, 2020 at 01:00:55PM -0700, Cy Schubert wrote:
>  |>> It's been 42 or more years since this bug was introduced. Let's \
>  |>> just fix it 
>  |>> now instead of agonizing over it.
>  |> 
>  |> I didn't want to add something as everything is said,
>  |> but this sentence is a little bit to provocative.
>  |> 
>  |> Everything is a file describes one of the defining features of Unix.
>  |> 
>  |> Calling this defining feature of Unix a bug shows to me that the ideas
>  |> behind Unix got lost in the FreeBSD universe too...
>  |
>  |Using linear storage for a directory is an implementation detail of the
>  |implementation. It's not a defining feature. "Reading" from a directory
>  |doesn't make sense for many other organisational forms. So, are you now
>  |arguing that leaky abstractions are a defining feature of Unix?
> 
> In an ideal Unix world read(2)ing from a directory fd would do the
> job that getdents(2) / getdirentries(2) never moved to a standard,
> leaving us with that terrible readdir(3) stuff.  imho.

That still doesn't work well with non-linear representations of
directories. readdir has issues, but plain read is even worse.

Joerg


More information about the freebsd-hackers mailing list