Subject: [bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

From: "Zack Weinberg" <[email-masked]>
Date: Sat, 14 Jan 2023 11:15:46 -0500

On Fri, Jan 13, 2023, at 6:33 PM, Karl Berry wrote:
>> your patch *and* consistently test flex with "--never-interactive".
>
> Making flex non-interactive sounds desirable in any case, but
> --never-interactive is not mentioned in the 2.6.0 --help message.
> Instead there is -B (--batch), although --never-interactive is
> recognized, I can see experimentally.

--never-interactive is documented in the Texinfo manual ("Options
Affecting Scanner Behavior" node).  It looks to me like the --help
output intentionally lists only the most commonly used options.

--never-interactive and --batch are technically orthogonal.  I don't
know any reason a *real* scanner would want to use --never-interactive
*without* --batch.  However, to address the specific problem with *test*
scanners we are discussing here, --never-interactive is what we want,
because --never-interactive is the option that makes the generated code
not call isatty().

> I do not know when --never-interactive, or any of its variants, was
> implemented. We should check that before using it ...

I'm pleasantly surprised to report that the Git repo for flex at
<https://github.com/westes/flex> has history going back all the way
to 1987.

The *feature* of optionally not calling isatty() on the input file
has been present since version 2.5.1 (released 1995-03-28), in the
form of `%option {always,never}-interactive` directives inside the
scanner.  The *command line option* --never-interactive was added
in version 2.5.6 (along with long command line options in general).
That version was released somewhere between 2002-04-19 and 2002-04-23;
the exact date is not recorded anywhere I can find.

zw