Re: [dev] [PATCH 1/2] find: "-" by itself is a file name

From: Tavian Barnes <tavianator_AT_tavianator.com>
Date: Fri, 2 Nov 2018 09:21:45 -0400

On Fri, 2 Nov 2018 at 04:22, Quentin Rameau <quinq_AT_fifth.space> wrote:
>
> Hello Tavian,
>
> > See https://savannah.gnu.org/bugs/?15235 for a discussion of why the
> > POSIX wording implies that "-" by itself is not part of the expression.
>
> I think this was a pedantly wrong interpretation of the standard.

It certainly is pedantic.

> The specification has been reworded since to prevent this:
>
> “The first operand and subsequent operands up to but not including the
> first operand that starts with a '-', or is a '!' or a '(', shall be
> interpreted as path operands.”
>
> “If the first operand starts with a '-', or is a '!' or a '(', the
> behavior is unspecified”
>
> So no, POSIX doesn't say (or imply) that "-" is to be treated as a path.
> The implementation is free to chose, then you can't expect
> compatibility there and shouldn't rely on that.

My interpretation of the linked thread was that "starts with" is
supposed to mean a strict prefix in POSIX, so "-" doesn't start with
"-". I haven't found anything in the standard that says that
explicitly though. If you'd rather interpret "starts with" to include
exact matches, feel free to drop this patch.

-- 
Tavian Barnes
Received on Fri Nov 02 2018 - 14:21:45 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 02 2018 - 14:24:07 CET