bug-gawk
[Top][All Lists]
Advanced

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

Re: fflush & close behavior not well-defined


From: arnold
Subject: Re: fflush & close behavior not well-defined
Date: Tue, 15 Sep 2020 12:09:59 -0600
User-agent: Heirloom mailx 12.5 7/5/10

"Andrew J. Schorr" <aschorr@telemetry-investments.com> wrote:

> On Tue, Sep 15, 2020 at 06:59:27AM +0000, Lorenz via Bug reports and all 
> discussion about gawk. wrote:
> > would gawk warning about such ambiguitiies be an option? At least in
> > --lint mode?
> > -- 
>
> I like that idea; I'd vote for issuing the warning regardless of whether
> --lint is set.

I'm working on this.  It'll be with --lint.

> The only downside is that we'd have to scan the entire
> list of redirections each time instead of bailing out at the first match,
> although that performance degradation could be fixed by storing the
> redirections in a hash table instead of in a linked list.

I see no need for this.  Too much code for something that would
be swamped by I/O anyway.

It's interesting. Gawk, mawk and BWK awk all allow opening the
same string as both a file and a pipe, and they do the right thing.
Gawk and BWK let you then call close() twice, successfully, whereas
mawk (apparently) closes both redirections the first time, returning -1
on the second.

FWIW, I'm not going to raise this issue with the POSIX committee; it's
the kind of thing they'd have no choice but to state that the behavior
is "unspecified".

Arnold



reply via email to

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