ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2001/03/22/15:56:54

Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-apps-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/lists.html#faqs>
Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com
Date: Thu, 22 Mar 2001 23:52:24 +0300
From: Egor Duda <deo AT logos-m DOT ru>
X-Mailer: The Bat! (v1.45) Personal
Reply-To: Egor Duda <cygwin-developers AT cygwin DOT com>
Organization: DEO
X-Priority: 3 (Normal)
Message-ID: <15325749005.20010322235224@logos-m.ru>
To: Egor Duda <cygwin-developers AT cygwin DOT com>
CC: cygwin-apps AT cygwin DOT com
Subject: bug in ash (Was: State of the DLL, mark 2?)
In-reply-To: <1983285237.20010321133832@logos-m.ru>
References: <20010319203650 DOT A30559 AT redhat DOT com>
<907012433 DOT 20010320162719 AT logos-m DOT ru> <20010320091254 DOT F32706 AT redhat DOT com>
<2710465067 DOT 20010320172451 AT logos-m DOT ru> <20010320101715 DOT K32706 AT redhat DOT com>
<1983285237 DOT 20010321133832 AT logos-m DOT ru>
Mime-Version: 1.0

Hi!

Wednesday, 21 March, 2001 Egor Duda deo AT logos-m DOT ru 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
ED> expressions.

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 <corinna AT vinschen DOT de>

        * memalloc.c: Revert previous patch until it's need is proved.

Tue Oct 10 16:46:00 2000  Corinna Vinschen <corinna AT vinschen DOT de>

        Patch suggested by Andy Mortimer <Andy DOT Mortimer AT software DOT aeat DOT 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
variable.

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
the former. 

Corinna, should i submit a patch or you'll reapply Andy's one?

Egor.            mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019