NetBSD-Bugs archive

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

Re: bin/48017: awk(1) fails to treat var as integer (may be related to #47840)



The following reply was made to PR bin/48017; it has been noted by GNATS.

From: Steffen "Daode" Nurpmeso <sdaoden%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/48017: awk(1) fails to treat var as integer (may be related
 to #47840)
Date: Fri, 05 Jul 2013 23:46:05 +0200

 Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:
  | Please, can you minimize the test case?  As far as I understand it
  | should be reducible to the script and to a single line of input that
  | triggers the problem.
 
 Hmmm.
 
   cat > test.sh <<\!
   printf '1 '; printf "F0000\n" |
   awk '{r2 = r1 = sprintf("%d", "0x" $1); while (r1 <= r2) {print r1; ++r1}}'
   printf '2 '; printf "F0000\n" |
   awk '{r1 = sprintf("%d", "0x" $1); r2 = r1; while (r1 <= r2) {print r1; 
++r1}}'
   printf '3 '; printf "F0000\n" |
   awk '{r1 = sprintf("%d", "0x" $1); while (r1 <= 983040) {print r1; ++r1}}'
   printf '4 '; printf "F0000\n" |
   awk '{r1 = sprintf("%d", "0x" $1); r2 = sprintf("%d", "0x" $1); while (r1 <= 
r2) {print r1; ++r1}}'
   printf '5 '; printf "F0000\n" |
   awk '{r1 = sprintf("%d", "0x" $1); r2 = sprintf("%d", "0x" $1); while (r1 <= 
r2) {print r1; ++r1}}'
   printf '6 '; printf "F0000 F0001\n" |
   awk '{r1 = sprintf("%d", "0x" $1); r2 = sprintf("%d", "0x" $1); while (r1 < 
r2) {print r1; ++r1}}'
   sh ./test.sh
 
 results in
 
   1 983040
   2 983040
   3 983040
   4 983040
   5 983040
   6
 
 So -- indeed.  Sorry.
 
  | -uwe
 
 --steffen
 
 But
 
   $ make ucd; ll test/sa/t_props.dat; make ucd-clean;\
   sed -e 40d -i '' tools/t-base.t; make ucd; ll test/sa/t_props.dat
 
 becomes (when i strip all the other messages)
 
   ucd: ok
   4956 -rw-rw-r--  1 steffen  staff  5071362  5 Jul 23:40 test/sa/t_props.dat
   ucd-clean: ok
   ...
   ucd: ok
   4188 -rw-rw-r--  1 steffen  staff  4284954  5 Jul 23:40 test/sa/t_props.dat
 


Home | Main Index | Thread Index | Old Index