This is the mail archive of the
mailing list for the Cygwin project.
bug in ash (Was: State of the DLL, mark 2?)
- To: Egor Duda <cygwin-developers at cygwin dot com>
- Subject: bug in ash (Was: State of the DLL, mark 2?)
- From: Egor Duda <deo at logos-m dot ru>
- Date: Thu, 22 Mar 2001 23:52:24 +0300
- CC: cygwin-apps at cygwin dot com
- Organization: DEO
- References: <20010319203650.A30559@redhat.com><firstname.lastname@example.org> <20010320091254.F32706@redhat.com><email@example.com> <20010320101715.K32706@redhat.com><firstname.lastname@example.org>
- Reply-To: Egor Duda <cygwin-developers at cygwin dot com>
Wednesday, 21 March, 2001 Egor Duda email@example.com wrote:
ED> well, i've managed to build it with -DMALLOC_PROVIDED, though it was a
ED> bit tricky, and it turned out that cygwin1.dll is not the one to
ED> blame. i fear that it's bug in ash -- it fails to evaluate complex
well, i've found the reason. moreover, i've found that as was once
patched to fix this bug, but later, patch was reverted. i wonder why.
did it have some ill side effects?
Thu Oct 12 14:28:00 2000 Corinna Vinschen <firstname.lastname@example.org>
* memalloc.c: Revert previous patch until it's need is proved.
Tue Oct 10 16:46:00 2000 Corinna Vinschen <email@example.com>
Patch suggested by Andy Mortimer <Andy.Mortimer@software.aeat.com>:
* memalloc.c: Add member `refcnt' to struct stack_block.
(stalloc): Initialize refcnt when allocating a new block.
(setstackmark): Increment refcnt when reusing a stack block.
(popstackmark): Decrement refcnt when dropping usage of a stack block.
(growstackblock): Reallocate a block only if it's used only once.
the proof of necessity of this patch is following: ash sometimes marks
a points on its internal stack via setstackmark and later restores to
saved state via popstackmark. "state" is simply a pointer to the
record on top of the stack. everythink works fine, until substitutions
are small enough to fit into 504 bytes of stack record. but if it
don't fit, we call growstackblock. it reallocates stack record, and
that means that mark pointer saved earlier no longer points to stack
record. so when we call popstackmark it frees all stack, hits the
bottom and calls free(stackbase), while stackbase is a static
If Andy's patch is wrong, i think i can propose another way -- to
divide stack_block into two separately dynamically allocated parts:
one of prev and data pointers, and other to contain all data. so we
will realloc () only the latter while saving "mark pointers" only to
Corinna, should i submit a patch or you'll reapply Andy's one?
Egor. mailto:firstname.lastname@example.org ICQ 5165414 FidoNet 2:5020/496.19