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

es dumps core, aargh...



All of a sudden, es has started dumping core on me when I run a
certain script on a DEC alpha (OSF 1 V3.2).

A session with gdb reveals that this happens when es tries to run an
external program:  While building the environment for the program, it
enters an infinite call loop

Cconv -> enclose -> enclose -> fmtprint -> printfmt -> Lconv -> getstr
-> str -> strv -> printfmt -> Cconv ...

until it runs out of stack space.  Below is a piece of the traceback,
showing where the loop starts.  I tried tracing the var variable in
the str procedure, at frame 33567, in the hopes of finding a cycle in
the data structure or something, but I could not go very far before
gdb failed (apparently, gdb could not figure out what a struct Term
was, so it would not print its fields for me...)

Anyway, here is the offending script, after I peeled away all kinds of
irrelevancies (I even removed the external program run, replacing it
by a simple echo of the offending variable):

#!/store/bin/es -p
fn v {echo + $* >[1=2] ; $*}
fn arch arch host wrap args {
    arches=$arches $arch
    if ({~ $wrap () || ~ $wrap -} {wrap=@{$*}})
    do.$arch=$wrap $arch $host $args}
arches=
v arch foo bar - yow
v @{echo $(do.$1)} foo
echo We never get here.

and here is the output:

; es -p ./test
+ arch foo bar - yow
+ @ * {echo $(do.^$1)} foo
segmentation violation

After I got this far in my debugging effort, I found that I could
avoid the problem by declaring
fn just-do-it {$*}
and replacing the @{*} inside the arch function by just-do-it.

Problem solved for now, but I wonder...  Has anybody else seen this?

- Harald

PS.  Excerpt from the stack trace:

#22548 0x120010b88 in Cconv (f=0x11fff60f0) at conv.c:223
#22549 0x12002a284 in printfmt (format=0x11fff60f0, fmt=0x14000b0e0 "%C")
    at print.c:252
#22550 0x12002d890 in strv (fmt=0x14000b0e0 "%C", args={
      __base = 0x11fff61c0 "à°", __offset = 8}) at str.c:35
#22551 0x12002d9c0 in str (fmt=0x14000b0e0 "%C") at str.c:47
#22552 0x12002f838 in getstr (term=0x14005c6d0) at term.c:67
#22553 0x12000fe4c in Lconv (f=0x11fff6480) at conv.c:17
#22554 0x12002a284 in printfmt (format=0x11fff6480, fmt=0x140007c60 "%S=%#L%s")
    at print.c:252
#22555 0x12002a400 in fmtprint (format=0x11fff6480, fmt=0x140007c60 "%S=%#L%s")
    at print.c:280
#22556 0x120010a38 in enclose (f=0x11fff6480, binding=0x14005eb88, 
    sep=0x140007b00 ";") at conv.c:182
#22557 0x120010a08 in enclose (f=0x11fff6480, binding=0x14005e2f0, 
    sep=0x140007a68 "") at conv.c:181
#22558 0x120010b88 in Cconv (f=0x11fff6480) at conv.c:223
#22559 0x12002a284 in printfmt (format=0x11fff6480, fmt=0x14000b0e0 "%C")
    at print.c:252
#22560 0x12002d890 in strv (fmt=0x14000b0e0 "%C", args={
      __base = 0x11fff6550 "à°", __offset = 8}) at str.c:35
#22561 0x12002d9c0 in str (fmt=0x14000b0e0 "%C") at str.c:47
#22562 0x12002f838 in getstr (term=0x14005c6d0) at term.c:67
#22563 0x120011b50 in Wconv (f=0x11fff6670) at conv.c:364
#22564 0x12002a284 in printfmt (format=0x11fff6670, fmt=0x14000ba90 "%F=%W")
    at print.c:252
#22565 0x12002d890 in strv (fmt=0x14000ba90 "%F=%W", args={
      __base = 0x11fff6740 "\220º", __offset = 8}) at str.c:35
#22566 0x12002d9c0 in str (fmt=0x14000ba90 "%F=%W") at str.c:47
#22567 0x120033b5c in mkenv0 (dummy=0x0, key=0x14005a648 "do.linuxelf", 
    value=0x14005a660) at var.c:276
#22568 0x120012dc4 in dictforall (dp=0x140063ac8, proc=0x120033a18 <mkenv0>, 
    arg=0x0) at dict.c:199
#22569 0x120033d78 in mkenv () at var.c:293
#22570 0x1200131e8 in forkexec (file=0x14006ec30 "/store/gnu/bin/mkdir", 
    list=0x14006e760, inchild=FALSE) at eval.c:30
#22571 0x120015c3c in eval (list0=0x14006e760, binding0=0x0, flags=0)
    at eval.c:452