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: Denis Shirokov
Subject: Re: gawk: "please file a bug report"
Date: Mon, 6 Sep 2021 18:49:01 +0300

another intresting thing is that if we're assign a "broken" value to
for example another variable - and test it using typeof() then we also
have "unknown" type

so it's looks like "unknown" may be used as the extra type of the
variable's value :)
i'm trying just a little bit joking))

thanx
Denis

2021-09-06 9:08 GMT+03:00, arnold@skeeve.com <arnold@skeeve.com>:
> 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]