bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IFS field splitting doesn't conform with POSIX


From: Felipe Contreras
Subject: Re: IFS field splitting doesn't conform with POSIX
Date: Thu, 30 Mar 2023 12:25:18 -0600

On Thu, Mar 30, 2023 at 11:48 AM Oğuz İsmail Uysal
<oguzismailuysal@gmail.com> wrote:
>
> On 3/30/23 7:51 PM, Felipe Contreras wrote:
> > So? This is argumentum ad populum. The fact that most shells do X
> > doesn't imply that POSIX says X.

> POSIX documents existing practice.

Your definition of what a standard is and mine are very different then.

In my view if POSIX was merely descriptive, then the Austin Group
would have no need to discuss much, as it's fairly easy to describe
what current shells do.

The challenge is in deciding what they *should* do, which is not
descriptive, but prescriptive. That requires much more consideration.

> If what it says differs from what the majority of shells do, then it's
> POSIX that is wrong.

Then there is no point in looking at the standard, since we know what
it should say, and there's no point in discussing about what it does
actually say.

> > Yes. 'foo,bar,' has two terminators, and therefore two fields.
> > 'foo,bar,roo' has two terminators and therefore two fields, plus
> > garbage. You want to interpret 'foo' as a field, even though it does
> > not have an an explicit terminator. But that's not specified anywhere
> > in POSIX. POSIX doesn't say what should be done with the text after
> > the last terminator. You could throw it away and still be conforming
> > to POSIX.

> I don't think *to SPLIT using delimiters as field terminators* involves
> leaving any part out.

The purpose of field terminators is to demarcate the termination of a
field, as in end or close, which is they are not used to split a
string, they are used to join fields in a way that ensures they are
complete.

If you see data like "Name:Peter;Age:35;Balance:30" you don't go and
conclude the last field ended in 30, especially if you are Peter.

If you don't care about the termination of a field, then there's no
point in using field terminators.

-- 
Felipe Contreras



reply via email to

[Prev in Thread] Current Thread [Next in Thread]