On Thu, Sep 18, 2008 at 02:02:07AM -0400, Glenn Fowler wrote:
> 
> ksh93t 2008-09-17 beta source has been posted at
> 
>   http://www.research.att.com/sw/download/beta/INIT.2008-09-17.tgz
>   http://www.research.att.com/sw/download/beta/ast-ksh.2008-09-17.tgz


Following fails:

  [...]
  test types.sh begins at 2008-09-18+09:38:30
  shtests: line 91: 22388: Memory fault
  test types.sh failed at 2008-09-18+09:38:30 with exit code 267 [ 30 tests 267 
errors ]
  [...]


on `Version M 93t 2008-09-17 linux.i386-64' ... I've
disabled -fno-tree-vrp nor used -fno-builtin-strdup.

Executing types.sh with the build ksh works.  The crash happens
only if SHELL is set to the path of the new builded ksh and
`$SHELL shtests' is executed ... changing line 91 of shtests
to be able to run `gdb --args $SHELL types.sh' was without errors.

The minimal script for a crash looks like

  VMDEBUG=a
  export VMDEBUG
  PWD=`pwd`
  PATH=/bin:/usr/bin:${PWD}
  $SHELL types.sh

and is executed here with the name `crash':

  d127:ksh93> SHELL=${PWD}/arch/linux.i386-64/src/cmd/ksh93/ksh
  d127:ksh93> export SHELL
  d127:ksh93> pushd src/cmd/ksh93/tests/
  /usr/src/packages/BUILD/ksh93/src/cmd/ksh93/tests 
/usr/src/packages/BUILD/ksh93
  d127:tests> $SHELL crash
  Segmentation fault
  d127:tests> popd
  /usr/src/packages/BUILD/ksh93
  d127:ksh93> 

after adding

  echo $$
  sleep 10

to types.sh I was able to attach the gdb to the running shell.  The following
extracted patch seems to solve the problem:

------------------------------------------------------------------------------
--- src/cmd/ksh93/sh/nvtype.c
+++ src/cmd/ksh93/sh/nvtype.c   2008-09-18 13:02:33.000000000 +0200
@@ -862,8 +862,12 @@ Namval_t *nv_mktype(Namval_t **nodes, in
                        else
                                size += n + dp->numnodes*strlen(&np->nvname[m]);
                        n = strlen(np->nvname);
-                       while(nodes[i+1] && (cp=nodes[i+1]->nvname) && 
memcmp(cp,np->nvname,n)==0 && cp[n]=='.')
+                       do
+                       {
+                               if(nodes[i]->nvlink.right == (Dtlink_t*)0)
+                                       break;
                                i++;
+                       } while(nodes[i] && (cp=nodes[i]->nvname) && 
memcmp(cp,np->nvname,n)==0 && cp[n]=='.');
                }
                else if(nv_isattr(np,NV_REF))
                        nref++;
------------------------------------------------------------------------------

Otherwiswe the nodes[i+1] accesses memory outside the ksh.


        Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to