Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2020 18:58:17 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Don Lewis <truckman@freebsd.org>
Cc:        Cy Schubert <Cy.Schubert@cschubert.com>,  "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: [HEADSUP] Disallowing read() of a directory fd
Message-ID:  <CACNAnaHv9nrSxQvc04ksJZLmbabTkgL9%2BzUydTtRrHPnbotjpw@mail.gmail.com>
In-Reply-To: <tkrat.8dea3141f8f7e5bd@FreeBSD.org>
References:  <CACNAnaFszg%2BQWPRS0kghsnQMxXc%2B5niPTTNiUPSmK60YyBGCzA@mail.gmail.com> <202005141954.04EJsCtH036247@slippy.cwsent.com> <tkrat.8dea3141f8f7e5bd@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 14, 2020 at 6:53 PM Don Lewis <truckman@freebsd.org> wrote:
>
> On 14 May, Cy Schubert wrote:
> > In message <CACNAnaFszg+QWPRS0kghsnQMxXc+5niPTTNiUPSmK60YyBGCzA@mail.gmail.c
> > om>
> > , Kyle Evans writes:
> >> Hi,
> >>
> >> This is a heads up, given that I'm completely flipping our historical
> >> behavior- I intend to commit this review in a couple days' time
> >> without substantial objection: https://reviews.freebsd.org/D24596
> >>
> >> With this, FreeBSD 13 will not allow read() of a directory fd, which
> >> could have previously returned some data from the underlying
> >> filesystem in no particular standardized format.
> >>
> >> This is a still-standards-compliant switch from one
> >> implementation-defined behavior to another that's already been adopted
> >> in various other popular kernels, to include OpenBSD, MacOS, and
> >> Linux.
> >>
> >> Worth noting is that there's not really one largely-compelling reasons
> >> to switch this after so many years (unless you find yourself that
> >> irate when you accidentally `cat` a directory), but there are some
> >> benefits which are briefly discussed in the commentary around the
> >> review along with the history of the current behavior.
> >>
> >> This change also simplifies filesystem implementations to some extent.
> >
> > OpenBSD has done this for a while and more importantly Linux.
>
> Which causes annoying noise to stderr if you 'grep something *' if there
> are directories in the working directory.
>

This is one that I actually find particularly annoying when I'm on a
UFS system, as my partial inquiries will sometimes match the names of
directory entries, so I'll get:

Binary file ${dirname} matches

That's almost never what I wanted, though.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaHv9nrSxQvc04ksJZLmbabTkgL9%2BzUydTtRrHPnbotjpw>