Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Buglette & Fix for checkrmall in 4.0.2



Hi,
just in case nobody else has been stumbled into this: 4.0.2 segfaults
in checkrmall() (under OpenLinux 3.1, i.e. Linux 2.4.* with glibc 2.2.1
and 2.2.4) when executing the following function:

function www {
	typeset netscapefiles="{lock,plugin-list*,history*,*cache/*,archive/*,*.db,abook.nab,registry,summary*,custom.dic}" \
		nsmaildir=$HOME/nsmail
	(	
		if [ -z "$DISPLAY" -a "$KPSYSTYPE" = 'i86linux' ]; then
			# Fire up X and start Mozilla from Linux text console:
			startx netscape "$@"
		else
			netscape "$@"
		fi
		# This crashes zsh-4.0.2 if unpatched:
		eval command rm -fr $HOME/.netscape/$netscapefiles /tmp/ndebug
		[ -d $nsmaildir ] && rmdir $nsmaildir
	) &
}

This is due to checkrmall() calling fprintf() with a NULL file ptr in
shout.

Please find attached the dumbest possible patch... it prevents the crash,
but I didn't investigate on wether it is the appropriate place for a
fix (should Zsh recognize that it's useless to call checkrmall() when
running in the background in the first place?  Is the NULL file ptr a
bug in itself?).

Cheers,
Stefan

P.S.: If you have any further questions, please set me on CC (I'm only on
      the Zsh announce list)
--
Dr.Ing. Stefan Dalibor <scd@xxxxxxxxxx>
--- zsh-4.0.2/Src/utils.c	Tue May 29 17:09:06 2001
+++ zsh-4.0.2/Src/utils.c-noshoutfix	Fri Oct 12 18:08:17 2001
@@ -1407,4 +1407,11 @@
 checkrmall(char *s)
 {
+    if (!shout) {
+	/*
+	 * This shells runs w/o access to a terminal, we can't query the
+	 * user...
+	 */
+	return (1);
+    }
     fprintf(shout, "zsh: sure you want to delete all the files in ");
     if (*s != '/') {


Messages sorted by: Reverse Date, Date, Thread, Author