bug-gawk
[Top][All Lists]
Advanced

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

Re: gawk: "please file a bug report"


From: arnold
Subject: Re: gawk: "please file a bug report"
Date: Mon, 06 Sep 2021 00:08:14 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Thanks for the notes.  This has been fixed for several weeks in
the current code base.

Arnold

J Naman <jnaman2@gmail.com> wrote:

> Woops! I was partly wrong: gensub() handles scalar numbers, the warning is
> for numeric array elements.
> n=gensub( /^/, "1", 1, 321); # numeric
> typeof(n) = 'string' after gensub; value of n= '1321'
>
> v = A[ i ]; # Denis's original
> after: typeof( A[i] ) unknown typeof(v) unknown
>
> On Sun, Sep 5, 2021 at 2:00 PM J Naman <jnaman2@gmail.com> wrote:
>
> > Looks like the problem is the number type, not the array. I experimented
> > with Deni's example and narrowed it down:
> > v = "" A[ i ]; # coerce number to string, then: no error
> > #add new lines:
> > n=2;   gensub( /^/, "1", 1, n ) # generates the warning
> > print "typeof(n) " typeof(n) " after gensub n= " n
> > # output: 'typeof(n) "unknown" after gensub n= 2'   # (still 2, but not a
> > number?)
> > So, Gawk might check the gensub() 'target' for not-a-string ...
> > -john naman
> >
> > On Sun, Sep 5, 2021 at 6:38 AM Denis Shirokov <cosmogen@gmail.com> wrote:
> >
> >> Hello gawk team
> >>
> >> I finally managed to set aside some time to investigate the typeof ()
> >> built-in function problem.
> >>
> >> I am attaching a script to reproduce the problem. and in my opinion
> >> this is an extremely strange bug. how the gensub/gsub/sub functions,
> >> when working with a local variable, can affect the contents of the
> >> array A, which is not even passed to it as a parameter, I really don’t
> >> have any idea about it.
> >>
> >> however - error will  not reproduce if for-in cycle will be located in
> >> BEGIN area
> >>
> >> with the Best Regards and Respect
> >>
> >> Denis Shirokov
> >>
> >



reply via email to

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