On Tue, Aug 19, 2014 at 02:44:29PM +0200, Werner Fink wrote:
> On Mon, Aug 18, 2014 at 09:34:56PM -0400, David Korn wrote:
> > Try this patch.  It should ignore that cat is a built-in of /bin/cat and
> > runs /bin/cat instead when it is the last command of ``.  Let me know if
> > this fixes the problem.
> > 
> > --- old/sh/xec.c        Mon Aug 18 17:53:43 2014
> > +++ new/sh/xec.c        Mon Aug 18 18:23:58 2014
> > @@ -1253,9 +1253,14 @@
> >                                 }
> >                                 if(np && pipejob==2)
> >                                 {
> > -                                       job_unlock();
> > -                                       nlock--;
> > -                                       pipejob = 1;
> > +                                       if(shp->comsub==1 && np &&
> > is_abuiltin(np) && *np->nvname=='/')
> > +                                               np = 0;
> > +                                       else
> > +                                       {
> > +                                               job_unlock();
> > +                                               nlock--;
> > +                                               pipejob = 1;
> > +                                       }
> >                                 }
> >                                 /* check for builtins */
> >                                 if(np && is_abuiltin(np))
> 
> This change works for the cat builtin but the test suite now shows:
> 
> [  907s] test subshell begins at 2014-08-19+12:40:15
> [  922s]        subshell.sh[682]: non-existant last command in pipeline 
> causes `` to fail
> [  922s] test subshell failed at 2014-08-19+12:40:30 with exit code 1 [ 70 
> tests 1 error ]
> [  922s] test subshell(C.UTF-8) begins at 2014-08-19+12:40:30
> [  936s]        subshell.sh[682]: non-existant last command in pipeline 
> causes `` to fail
> [  936s] test subshell(C.UTF-8) failed at 2014-08-19+12:40:44 with exit code 
> 1 [ 70 tests 1 error ]
> [  936s] test subshell(shcomp) begins at 2014-08-19+12:40:44
> [  951s]        shcomp-subshell.ksh[682]: non-existant last command in 
> pipeline causes `` to fail
> [  951s] test subshell(shcomp) failed at 2014-08-19+12:40:59 with exit code 1 
> [ 70 tests 1 error ]

Just seen this during debugging:

 BUILD/ksh93> ./arch/linux.i386-64/src/cmd/ksh93/ksh -c 'while((SECONDS<3)); do 
test -z `/bin/false | /bin/false | /bin/doesnotexist`;done;:' 2> /dev/null 
 Segmentation fault (core dumped)
 BUILD/ksh93> gdb ./arch/linux.i386-64/src/cmd/ksh93/ksh core
 GNU gdb (GDB) SUSE (7.5.1-0.7.29)
 Copyright (C) 2012 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 [...]
 Core was generated by `./arch/linux.i386-64/src/cmd/ksh93/ksh -c 
while((SECONDS<3)); do test -z `/bin/'.
 Program terminated with signal 11, Segmentation fault.
 #0  bestlistreclaim (listp=<optimized out>, pack=<optimized out>, 
vm=<optimized out>) at 
/usr/src/packages/BUILD/ksh93/src/lib/libast/vmalloc/vmbest.c:471
 471                     SIZE(fp) |= MARK;
 (gdb) print fp
 $1 = (Block_t *) 0x400000

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: pgpJilMAYtLRi.pgp
Description: PGP signature

_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to