bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: 3.1.0 core dumps. Fiddling with OFMT?


From: Aharon Robbins
Subject: Re: 3.1.0 core dumps. Fiddling with OFMT?
Date: Wed, 13 Jun 2001 18:09:47 +0300

Greetings.  Concerning this:

> To: address@hidden
> cc: David Jones <address@hidden>
> Subject: 3.1.0 core dumps.  Fiddling with OFMT?
> Date: Wed, 13 Jun 2001 14:45:54 +0000
> From: David Jones <address@hidden>
>
> The following program causes gawk to dump core:
>
> jot 10|./gawk '{OFMT="%."NR"f";print NR}'
>
> 'jot 10', if you didn't know, produces the numbers 1 to 10 each on its
> own line (ie it's like awk 'BEGIN{for(i=1;i<=10;++i)print i}')
>
> Here's an example run:
>
> -- run being
> 1
> 2
> 3
> 4
> gawk: cmd. line:1: (FILENAME=- FNR=5) fatal error: internal error
> Abort trap - core dumped
> -- run end
>
> Ah.  print NR appears to be not interesting.  The following program also
> has the same problem:
>
> jot 10|./gawk '{OFMT="%."NR"f"}'
>
> Cheers,
>  djones

This is something of a day 1 bug.  Fortunately, the fix was easy
to track down.  Here is an unofficial patch.

Thanks!

Arnold
---------------------------------------------------------------------------
Wed Jun 13 18:07:06 2001  Arnold D. Robbins  <address@hidden>

        * eval.c (fmt_index): Actually call erealloc() to grow fmt_list
          if that's really necessary.  Bug report from David Jones,
          address@hidden

*** ../gawk-3.1.0/eval.c        Tue May 15 08:56:31 2001
--- eval.c      Wed Jun 13 18:05:02 2001
***************
*** 2013,2019 ****
  
        if (fmt_hiwater >= fmt_num) {
                fmt_num *= 2;
!               emalloc(fmt_list, NODE **, fmt_num, "fmt_index");
        }
        fmt_list[fmt_hiwater] = dupnode(n);
        return fmt_hiwater++;
--- 2013,2019 ----
  
        if (fmt_hiwater >= fmt_num) {
                fmt_num *= 2;
!               erealloc(fmt_list, NODE **, fmt_num * sizeof(*fmt_list), 
"fmt_index");
        }
        fmt_list[fmt_hiwater] = dupnode(n);
        return fmt_hiwater++;



reply via email to

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