bin/180328: awk(1) fails to treat var as integer

Steffen Daode Nurpmeso sdaoden at gmail.com
Fri Jul 5 21:52:49 UTC 2013


Hello.
uwe at netbsd prodded that i dig a bit deeper and so here is the
thing a bit narrowed down.  Sorry.

 | 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


More information about the freebsd-bugs mailing list