9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Tharaneedharan Vilwanathan" <vdharani@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Subject: [9fans] a bug in awk?
Date: Fri,  9 Jan 2009 21:57:12 -0800	[thread overview]
Message-ID: <dac0a5820901092157t2a20d4f2j3325c25f9f3335d5@mail.gmail.com> (raw)

hi,

while i was playing with venti archive, i found something interesting.

i used dumpvacroots.new (from contrib) and for some reason, awk bailed
out with floating point error whenever it saw a line with a specific
root score.

here are the two sample lines (i used customized printarena.c which
prints the date for me at the end):

              11260359 d05544897ff642ca36e58174bc753b0f3382b793   0
8192 Jan  9 18:09
              11258672 5946903e318d3596c21e35b42a13c1dea5fd32cc   0
8192 Jan  9 18:09

awk seems to be okay with the first line but not the second line.

here is the output when i use awk:

mill# awk ' { print $0; print NF}' /tmp/out1.dat
              11260359 d05544897ff642ca36e58174bc753b0f3382b793   0
8192 Jan  9 18:09
7
              11258672 5946903e318d3596c21e35b42a13c1dea5fd32cc   0
8192 Jan  9 18:09
awk: floating point exception 6
 input record /tmp/out1.dat:2
 source line 1

i figured that:

- awk runs fine if i dont print NF. (so, it parses the line on-demand
and parsing fails?)
- awk doesnt seem to like the score 5946....32cc. If I change that
score to something else and rerun, it seems to be fine.

to confirm that this is a plan9 specific awk issue, i tried the same
with my Mac machine. it seems to be okay:

$ awk ' { print $0; print NF }' out1.dat
              11260359 d05544897ff642ca36e58174bc753b0f3382b793   0
8192 Jan  9 18:09
7
              11258672 5946903e318d3596c21e35b42a13c1dea5fd32cc   0
8192 Jan  9 18:09
7

what could be the issue? any clues?

i initially thought my venti data got corrupted but i am now convinced
that this is something else, since i was also able to reliably archive
data.

thanks
dharani



             reply	other threads:[~2009-01-10  5:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-10  5:57 Tharaneedharan Vilwanathan [this message]
2009-01-10  6:26 ` lucio
2009-01-10  6:39   ` Tharaneedharan Vilwanathan
2009-01-10 16:19   ` John Stalker
2009-01-10 19:43     ` erik quanstrom
2009-01-10 21:45 erik quanstrom
2009-01-11  7:07 ` Russ Cox
2009-01-11  7:24   ` erik quanstrom
2009-01-11  9:30 ` Tharaneedharan Vilwanathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dac0a5820901092157t2a20d4f2j3325c25f9f3335d5@mail.gmail.com \
    --to=vdharani@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).