bug-gawk
[Top][All Lists]
Advanced

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

Re: "prints a surprising 1" cannot be reproduced


From: Nelson H. F. Beebe
Subject: Re: "prints a surprising 1" cannot be reproduced
Date: Sun, 6 Dec 2020 14:41:32 -0700

Arkadiusz Drabczyk <arkadiusz@drabczyk.org> reports:

>> in gawktexi.in it says
>> 
>> "the following (extreme) pipeline prints a surprising @samp{1}:
>> 
>> @example
>> $ @kbd{echo | gawk --posix 'BEGIN @{ RS = "a" @} ; @{ print NF @}'}
>> @print{} 1
>> @end example
>> "
>> 
>> But I cannot reproduce it with gawk built from today's master branch:
>> 
>> $ echo | ./gawk --posix 'BEGIN { RS = "a" } ; { print NF}'
>> 0

Here is where things changed:

foreach f ($B/gawk*)
    echo ============= $f:t
    echo | $f --posix 'BEGIN { RS = "a" } ; { print NF}'
end
============= gawk-4.1.1b
1
============= gawk-4.1.1c
1
============= gawk-4.1.1d
1
============= gawk-4.1.2
1
============= gawk-4.1.3
1
============= gawk-4.1.3g
1
============= gawk-4.1.3h
1
============= gawk-4.1.4
1
============= gawk-4.1.60
0
============= gawk-4.1.61
0
============= gawk-4.1.62
0
============= gawk-4.1.63
0
============= gawk-4.1.65
0
============= gawk-4.2.0
0
============= gawk-4.2.1
0
============= gawk-4.2.1a
0
============= gawk-4.2.60
0
============= gawk-4.2.61
0
============= gawk-4.2.64
0
============= gawk-5.0.61
0
============= gawk-5.0.63
0
============= gawk-5.0.65
0
============= gawk-5.1.0
0

I can go back many more versions on an older machine, but the above
experiment shows that a change between gawk-4.1.4 and gawk-4.1.60
is the culprit.

The question for the chief architect is now: which is the desired
behavior: the manual's specification, or the code's implementation?

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe@math.utah.edu  -
- 155 S 1400 E RM 233                       beebe@acm.org  beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------



reply via email to

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