On Tue, Jun 28, 2011 at 02:49:25AM +0200, Cyrille Lefevre wrote:
> 
> Le 31/05/2011 15:07, Cyrille Lefevre a écrit :
> 
> ping
> 
> >Le 24/05/2011 23:10, Cyrille Lefevre a écrit :
> >
> >ping
> >
> >>Hi,
> >>
> >>the following sentence works under ksh88, mksh and bash,
> >>but doesn't under ksh93 :
> >>
> >>/opt/ast/bin/ksh -c 'function foo {
> >>typeset rc=0; unset -f foo; return $rc;
> >>}; foo'
> >>Segmentation fault
> >>
> >>/opt/ast/bin/ksh --version
> >>version sh (AT&T Research) 93u 2011-02-08
> >>
> >>doesn't work also under RHEL r and s+ release.
> >>
> >>this one seems to work :
> >>
> >>/opt/ast/bin/ksh -c 'function foo { unset -f foo; }; foo'
> >>
> >>but not this one too (segfault under cygwin,
> >>but ok, from memory, under RHEL 5.2 and 5.4) :
> >>
> >>/opt/ast/bin/ksh -c 'function foo { unset -f foo; return 0; }; foo'
> >>Segmentation fault
> >

Teh attached patch e.g. for Version JM 93t+ 2010-06-21, should
do the job.

     Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c	2011-07-04 15:09:52.252426415 +0000
@@ -2780,7 +2780,8 @@ int sh_funscope(int argn, char *argv[],i
 	jmpval = sigsetjmp(buff.buff,0);
 	if(!fun)
 	{
-		shp->st.filename = fp->node->nvalue.rp->fname;
+		if (fp->node->nvalue.rp)
+			shp->st.filename = fp->node->nvalue.rp->fname;
 		shp->st.funname = nv_name(fp->node);
 		shp->last_root = nv_dict(DOTSHNOD);
 		nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to