delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/05/19/06:05:58

From: "Tim Van Holder" <tim DOT van DOT holder AT pandora DOT be>
To: <djgpp-workers AT delorie DOT com>
Subject: Re: Possible bash issue
Date: Sat, 19 May 2001 12:05:36 +0200
Message-ID: <CAEGKOHJKAAFPKOCLHDIKEGGCDAA.tim.van.holder@pandora.be>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal
In-Reply-To: <3B0599E9.21329.13FC05@localhost>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I made the example stand-alone (by providing a script that
> performs the same
> function as --fallback-echo) and I couldn't reproduce the
> problem. I changed
> to a previous bash 2.04 and also got the same answer. bash 2.05
> also gives
> the same answer. I added a statement to output the i variable and
That's what I would expect; anything up until the current bash
version did the same for me.

> it stops at
> 16 every time (2.04 current, 2.04 previous, 2.05 alpha). I also
Well, for me it kept going until 21 at least...

> manually ran
> 'ltconfig ltmain.sh' and it gave the same answer.
>
> You might try disabling the memory leak fix in execute_cmd.c (search for
> 'free (args)') and see if that makes a difference.
It did - it made the debug build crash as well :-)

I did find the problem though - I made 1 (one) change to the source. Where
it used to say (in shell.c)

      if (gethostname (hostname, 255) < 0)
	  current_host_name = "??host??";
      else
	  current_host_name = savestring (hostname);

I put

      if (getenv ("HOSTNAME") != NULL)
	  current_host_name = savestring (getenv ("HOSTNAME"));
      else if (gethostname (hostname, 255) < 0)
	  current_host_name = "??host??";
      else
	  current_host_name = savestring (hostname);

because I don't like the way it gets upcased by gethostname (and I have the
hostname in my prompt).  This has worked without problems so far (I first
added it to 1.14.7 I think).  Disabling made the crashes go away though.
Since the the fallback ("??host??") isn't dynamically allocated, this looked
like a potential memory leak (since current_host_name is never freed) - and
sure enough: removing the savestring() from the getenv() made the crash go
away as well.  I still don't know why it crashed exactly, but it works fine
again now, so I think I'll just leave well enough alone.

- Raw text -


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