plan9fox/sys/src/cmd/awk
Ori Bernstein 10afa189d5 awk: correct incoherent cell in assignment (thanks smj, mpinjr)
In run.c::assign(), assigning to $0 from $F, a field,
where F >= 2, produces an incoherent cell.

The assignment occurs in two steps, first the string value
and then the float. When the string value is assigned to $0,
setsval invalidates the fields. If FS hasn't changed, after
getfval rebuilds the fields, NF = 1 and F >= 2, therefore $F
is definitely uninitialized. The result is a float val of
0.0, producing a boolean false in the pattern expression.

Coercing a string comparison gives the expected result
because the incoherent cell has the correct string
value, which is not empty and evaluates to true.
2022-06-25 20:03:41 +00:00
..
awk.h awk: allow string as exit status 2017-08-12 21:34:06 +02:00
awkgram.y awk: allow string as exit status 2017-08-12 21:34:06 +02:00
lex.c awk: allow string as exit status 2017-08-12 21:34:06 +02:00
lib.c awk: initialize records fully in recinit() 2022-06-25 18:58:55 +00:00
main.c improve usage messages (thanks henesy) 2020-03-10 10:09:34 -07:00
maketab.c awk: handle bad/incomplete input in maketab (thanks kenji arisawa) 2017-06-02 19:03:37 +02:00
mkfile awk: fix race condition with sub-mk in mkfile 2020-05-24 16:00:45 +02:00
parse.c awk: allow string as exit status 2017-08-12 21:34:06 +02:00
popen.c remove ape regexp library, add utility for awk native port 2016-04-27 07:52:41 -05:00
proto.h awk: bring back ENVIRON[] support 2016-05-02 00:34:23 +02:00
re.c New libregexp and APE ported to native 2016-04-26 22:23:44 -05:00
run.c awk: correct incoherent cell in assignment (thanks smj, mpinjr) 2022-06-25 20:03:41 +00:00
tran.c awk: bring back ENVIRON[] support 2016-05-02 00:34:23 +02:00