On Fri, 2008-11-21 at 10:54 +0200, Timo Teräs wrote:
> Natanael Copa wrote:
> > On Thu, 2008-11-20 at 23:42 +0100, Cristian Ionescu-Idbohrn wrote:
> >> On Thu, 20 Nov 2008, Bernhard Reutner-Fischer wrote:
> >>
> >>> On Wed, Nov 19, 2008 at 09:30:27PM +0100, Natanael Copa wrote:
> >>>> On Wed, 2008-11-19 at 21:17 +0100, Natanael Copa wrote:
> >>>>> shorter testcase:
> >>>>>
> >>>>> ash -c "foo() { ! false && echo foo; }; foo"
> >>> Works for me on trunk (on a debian box)..
> >> Doesn't work for me :(  I get something else:
> >>
> >>   ash: memory exhausted

...

> Looks like ash was broken in commit r23583 where the node type defines
> were changed, but related arrays were not updated. Especially the node
> size table which affects size calculations was left out, thus all kind
> of funny things such as memory corruption can happen.
> 
> Please try the below patch:
> 
> Index: shell/ash.c
> ===================================================================
> --- shell/ash.c       (revision 24107)
> +++ shell/ash.c       (working copy)
> @@ -7556,7 +7556,7 @@
>  #define EV_TESTED 02            /* exit status is checked; ignore -e flag */
>  #define EV_BACKCMD 04           /* command executing within back quotes */
>  
> -static const short nodesize[26] = {
> +static const short nodesize[27] = {
>       SHELL_ALIGN(sizeof(struct ncmd)),
>       SHELL_ALIGN(sizeof(struct npipe)),
>       SHELL_ALIGN(sizeof(struct nredir)),
> @@ -7578,6 +7578,7 @@
>       SHELL_ALIGN(sizeof(struct nfile)),
>       SHELL_ALIGN(sizeof(struct nfile)),
>       SHELL_ALIGN(sizeof(struct nfile)),
> +     SHELL_ALIGN(sizeof(struct nfile)),
>       SHELL_ALIGN(sizeof(struct ndup)),
>       SHELL_ALIGN(sizeof(struct ndup)),
>       SHELL_ALIGN(sizeof(struct nhere)),
> 
> 
> Cheers,
>   Timo

wow! nasty one. you're the man!

nc svn # ./busybox ash -c "f() { ! false && echo foo; }; f"
foo

This patch should be added to fixes 1.13.0

-nc

_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to