Hi!

----

Below is a small reduced testcase (based on a larger application which
crashes the same way) which cases a crash in libshell code (current
codebase is ast-ksh.2009-05-05):
-- snip --
#include <shell.h>

int
main(int argc, char *argv[])
{
        int i;
        Shell_t *shp;

        char *ar[2]={ "/usr/bin/sh", NULL };

        shp = sh_init(1, ar, 0);
        if (!shp)
                error(ERROR_exit(1), "shell initialisation failed.");
        (void) sh_trap("alias -v", 0);

        return (0);
}
-- snip --

Output and stack trace look like this:
-- snip --
$ ./a.out
alias: -v: unknown option
Usage: alias [-ptx] [name[=value]...]
signal SEGV (no mapping at the fault address) in longjmp at 0xfefbe7a4
0xfefbe7a4: longjmp+0x0008:     ldd      [%o2], %l0
Current function is main
   15           (void) sh_trap("alias -v", 0);
(dbx) where
  [1] longjmp(0xff32f168, 0x6, 0x0, 0x3400, 0x0, 0xff2c5ed8), at
0xfefbe7a4 
  [2] sh_trap(0x0, 0x0, 0xff32c000, 0x6, 0x0, 0xff32eee4), at 0xff2b8d20 
=>[3] main(argc = 1, argv = 0xffbffb6c), line 15 in "aliascrash.c
-- snip --

It seems "alias" hits an error and then tries a |longjmp()| which goes
wrong somehow...
... my guess is that my usage of |sh_trap()| is somehow wrong - do I
have do to anything extra to prevent this kind of crash ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to