zsh-workers
 help / color / mirror / code / Atom feed
* zsh segfault
@ 2001-08-23 22:03 Thomas Eriksson
  2001-08-24  1:47 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Eriksson @ 2001-08-23 22:03 UTC (permalink / raw)
  To: zsh-workers

Hi

I'm the author of bashish, which aims to bring themes (title, font, background, size and so on) to the console.

I'm trying to get bashish working on most bourne style shells including zsh.

However after upgrading zsh 3.0.8 to zsh 4.0.2 (also tried 4.1.0-dev1) zsh segfaulted in a particular moment.

I've created a feature to select themes for each application, that is if you start your favourite text editor the background will become white and the foreground black and also changing to an easy to read font.
Then after the application is finished, your console will return to black colored background and your favourite console - hard to read, but cool - font.

however right after the application has finished, the console has been restored to it's initial theme, and zsh shows the prompt and waits for input.

Whenever you press [Return] then, zsh will crash and burn.

changing themes seems not to be a problem though:

## changes to the joe application theme (.alias indicates that the theme is initialized as an alias not a function)
$ btapp joe.alias
## restores world order
$ brefresh

I'd be willing to investigate this further, unfortually, I'm a shell script hacker who doesn't even know how to run gdb on zsh.

Zsh 3.0.8 does not have this bug

My system is a Dual Celeron 433, 64MB ram and a 1200 mb hd, Linux Slackware 7.2-current
I hope this can help you.

sincerely

/Thomas Eriksson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh segfault
  2001-08-23 22:03 zsh segfault Thomas Eriksson
@ 2001-08-24  1:47 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2001-08-24  1:47 UTC (permalink / raw)
  To: Thomas Eriksson, zsh-workers

On Aug 24, 12:03am, Thomas Eriksson wrote:
}
} I'd be willing to investigate this further, unfortually, I'm a shell
} script hacker who doesn't even know how to run gdb on zsh.

It would probably be the most helpful if you would

	set -x
	exec 2>/tmp/xtrace.log

then immediately do whatever it is you do to cause the shell to crash,
and send us the resulting file.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh segfault
  2001-08-24  9:23 Thomas Eriksson
@ 2001-08-24 23:00 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2001-08-24 23:00 UTC (permalink / raw)
  To: Thomas Eriksson, zsh-workers

On Aug 24, 11:23am, Thomas Eriksson wrote:
> 
> printf "unset -f precmd \n" 1>/home/arne/wuf
> alias wuf="echo wuf wuf;precmd () { . /home/arne/wuf ; }"
> wuf

The alias isn't necessary; so is the unset -f.  Any "." or "source"
command from within precmd() gives:

BUG: chline is NULL in hend()

(which is only visible with configure --enable-zsh-debug).

This is happening because source() re-enters loop(), which clobbers the
hbegin(1) at the top of the function.  The following fixes it, but I'm
wondering if there's a better way.

(The reason this doesn't happen in 3.0.x is that the hbegin() in loop()
happens later, after preprompt() -- but 4.0.x has a bunch of special
variables that might be used in `precmd' and that refer to the history,
so the initialization has to happen sooner.)

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.18.4.1
diff -c -r1.18.4.1 init.c
--- Src/init.c	2001/06/30 18:30:07	1.18.4.1
+++ Src/init.c	2001/08/24 22:53:36
@@ -107,6 +107,8 @@
     pushheap();
     for (;;) {
 	freeheap();
+	if (stophist == 3)	/* re-entry via preprompt() */
+	    hend(NULL);
 	hbegin(1);		/* init history mech        */
 	if (isset(SHINSTDIN)) {
 	    setblock_stdin();
@@ -114,7 +116,10 @@
 	        int hstop = stophist;
 		stophist = 3;
 		preprompt();
-		stophist = hstop;
+		if (stophist != 3)
+		    hbegin(1);
+		else
+		    stophist = hstop;
 		errflag = 0;
 	    }
 	}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh segfault
@ 2001-08-24  9:23 Thomas Eriksson
  2001-08-24 23:00 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Eriksson @ 2001-08-24  9:23 UTC (permalink / raw)
  To: zsh-workers

Hi

I managed to locate the error further, this code gives the same results

printf "unset -f precmd \n" 1>/home/arne/wuf
alias wuf="echo wuf wuf;precmd () { . /home/arne/wuf ; }"
wuf

and this is the output of /tmp/xtrace.log

-- /tmp/xtrace.log --
+zsh:5> printf unset -f precmd \n
+zsh:6> alias wuf=echo wuf wuf;precmd () { . /home/arne/wuf ; }
+zsh:7> echo wuf wuf
+precmd:0> . /home/arne/wuf
+/home/arne/wuf:1> unset -f precmd
-- EOF --

/Thomas Eriksson
> 
> It would probably be the most helpful if you would
> 
> 	set -x
> 	exec 2>/tmp/xtrace.log
> 
> then immediately do whatever it is you do to cause the shell
> to crash,
> and send us the resulting file.
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-08-24 23:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 22:03 zsh segfault Thomas Eriksson
2001-08-24  1:47 ` Bart Schaefer
2001-08-24  9:23 Thomas Eriksson
2001-08-24 23:00 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).