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

Re: PATCH: Re: Segmentation fault 3.1.7-pre-3/4



On May 23, 10:31am, Sven Wischnowsky wrote:
} Subject: PATCH: Re: Segmentation fault 3.1.7-pre-3/4
}
} Bernd Eggink wrote:
} 
} > This gives a seg fault if executed in a script:
} > 
} >     read -q "REPLY?hm: "
} > 
} > Happens with pre-3 and pre-4, not with pre-1.
} 
} Oh, look Bart, there's the reason to not always use shout (11036).

Hmm, why did I think that SHTTY != -1 mean that shout was nonzero?

I personally would prefer the following patch, but I haven't committed
it yet.

Index: builtin.c
===================================================================
@@ -4970,6 +4970,10 @@
 		    oshout = shout;
 		    init_shout();
 		}
+	    } else if (!shout) {
+		haso = 1;
+		oshout = shout;
+		init_shout();
 	    }
 	    /* We should have a SHTTY opened by now. */
 	    if (SHTTY == -1) {



On May 23, 10:10am, Peter Stephenson wrote:
} Subject: Re: PATCH: Re: Segmentation fault 3.1.7-pre-3/4
}
} Sven wrote
} > But with zle not loaded, the
} > 
} > 	zsh -c "read -q '?Can you see this? '" < /dev/null >& /dev/null
} > 
} > from 11036 doesn't show the prompt (but at least it doesn't segv
} > anymore). Is it right or wrong? Do we have to work around it?
} 
} Seems to me that after doing your damnedest *not* to have the prompt shown,
} you don't want it.  `read -q' is documented as always reading from
} the terminal, and the prompt as printing on stderr.  I haven't checked
} that's what's actually going on, but it's consistent.

It's confusing.  If I've written a script and embedded a "read -q" in it
somewhere, chances are I expect it to display the prompt and not just
hang mysteriously until the user happens to touch the keyboard.  It should
not be necessary to always write something like

	[[ -t 2 ]] && read -q '?Can you see this? ' 2>/dev/tty

because the shell knows much better than I do whether there *is* a tty.

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



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