9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] ape strtod crash
@ 2009-07-30  8:40 roger peppe
  2009-07-30 11:29 ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: roger peppe @ 2009-07-30  8:40 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

this ape program gives a floating point exception error:

#include <stdlib.h>
void
main(){
	strtod("421567849e316", 0);
}

this made awk crash when i was running dumpvacroots.
it dies at /sys/src/ape/lib/ap/stdio/strtod.c:473
but it looks a bit involved for me to dive into right now,
i'm afraid.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] ape strtod crash
  2009-07-30  8:40 [9fans] ape strtod crash roger peppe
@ 2009-07-30 11:29 ` erik quanstrom
  2009-07-30 12:16   ` roger peppe
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2009-07-30 11:29 UTC (permalink / raw)
  To: 9fans

On Thu Jul 30 04:42:29 EDT 2009, rogpeppe@gmail.com wrote:
> this ape program gives a floating point exception error:
>
> #include <stdlib.h>
> void
> main(){
> 	strtod("421567849e316", 0);
> }
>
> this made awk crash when i was running dumpvacroots.
> it dies at /sys/src/ape/lib/ap/stdio/strtod.c:473
> but it looks a bit involved for me to dive into right now,
> i'm afraid.
>

fixed,

http://9fans.net/archive/2009/01/234

- erik




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] ape strtod crash
  2009-07-30 11:29 ` erik quanstrom
@ 2009-07-30 12:16   ` roger peppe
  2009-07-30 13:25     ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: roger peppe @ 2009-07-30 12:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

2009/7/30 erik quanstrom <quanstro@quanstro.net>:
> fixed,
>
> http://9fans.net/archive/2009/01/234

ok, thanks, i had a very vague memory of this, but obviously
my googling was inadequate.

did you submit a patch? i can't see one.
i will if not - it's an annoying error.

(and, as you say, why not just use the usual strtod?)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] ape strtod crash
  2009-07-30 12:16   ` roger peppe
@ 2009-07-30 13:25     ` erik quanstrom
  2009-07-30 13:30       ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2009-07-30 13:25 UTC (permalink / raw)
  To: 9fans

On Thu Jul 30 08:18:45 EDT 2009, rogpeppe@gmail.com wrote:
> 2009/7/30 erik quanstrom <quanstro@quanstro.net>:
> > fixed,
> >
> > http://9fans.net/archive/2009/01/234
>
> ok, thanks, i had a very vague memory of this, but obviously
> my googling was inadequate.
>
> did you submit a patch? i can't see one.
> i will if not - it's an annoying error.

i'm sorry.  i wasn't sure this patch met the standards,
and then i forgot about it.  i've found that patches
like this are hard to go far enough yet not go too
far.

/n/sources/patch/apestrtod.

here's a demonstration of the fix.  awk is sufficient
to demonstrate the problem with the number you mention.

; echo 421567849e316 | /n/sources/plan9/386/bin/awk '{print}'
421567849e316
; 9fs sources
; ; echo 421567849e316 | /n/sources/plan9/386/bin/awk '{print}'
/n/sources/plan9/386/bin/awk: floating point exception 6
 source line 1

>
> (and, as you say, why not just use the usual strtod?)
>

a partial answer is in /sys/src/ape/lib/fmt/strtod.c's comments.
there are cases were ERANGE is appropriate in unix land.

this is the hard question.  perhaps dumping ape stdio's strtod
and editing the usual one to fit unix's model would be the right
plan.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] ape strtod crash
  2009-07-30 13:25     ` erik quanstrom
@ 2009-07-30 13:30       ` erik quanstrom
  0 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2009-07-30 13:30 UTC (permalink / raw)
  To: 9fans

!> ; echo 421567849e316 | awk '{print}'
> 421567849e316
> ; 9fs sources
> ; ; echo 421567849e316 | /n/sources/plan9/386/bin/awk '{print}'
> /n/sources/plan9/386/bin/awk: floating point exception 6
>  source line 1

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-30 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-30  8:40 [9fans] ape strtod crash roger peppe
2009-07-30 11:29 ` erik quanstrom
2009-07-30 12:16   ` roger peppe
2009-07-30 13:25     ` erik quanstrom
2009-07-30 13:30       ` erik quanstrom

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).