bug-gawk
[Top][All Lists]
Advanced

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

Re: accessing ENVIRON causes SIGFPE when first var is numeric


From: Wolfgang Laun
Subject: Re: accessing ENVIRON causes SIGFPE when first var is numeric
Date: Wed, 15 Jun 2022 21:52:30 +0200

On Wed, 15 Jun 2022 at 16:56, <arnold@skeeve.com> wrote:

> Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>
> > SETENV(3) appears to be the function that determines what may or may not
> be
> > in the Environment. From the man page's ERROR section: EINVAL name is
> NULL,
> > points to a string of length 0, or contains an '=' character. Names
> weirder
> > than a digit should be possible.
> >
> > Wolfgang
>
> So 0=foo is apparently valid, but will probably give shells a fit.
>

The exec*e calls pass a vector of C string references for an Environment,
i.e., the very basic data structure required by the *nixes. C programs have
to adhere to the setenv restriction so that getenv works and parsing the
strings into <name>=<value> is possible. Shells are very specific programs
that have to make more restrictions so that their variable name syntax is
not violated. A shell will simply ignore Environment entries that don't
follow this pattern, but they won't have a fit if there's a string that
does not fit. You cannot circumvent the shell's insistence of proper names
by using a reference type variable; the shell blocks efforts to assign an
invalid name string to such a variable.

Wolfgang


>
> I will add Andy's patch soon.
>
> Thanks,
>
> Arnol
>


-- 
Wolfgang Laun


reply via email to

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