From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6741 invoked from network); 17 Dec 2007 23:41:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Dec 2007 23:41:27 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 35230 invoked from network); 17 Dec 2007 23:41:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Dec 2007 23:41:22 -0000 Received: (qmail 17563 invoked by alias); 17 Dec 2007 23:41:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24276 Received: (qmail 3669 invoked from network); 17 Dec 2007 23:25:16 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Dec 2007 23:25:16 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id 956608058F54 for ; Tue, 18 Dec 2007 00:22:10 +0100 (CET) Received: from ice.42.org (ice.42.org [194.77.85.2]) by bifrost.dotsrc.org (Postfix) with ESMTP for ; Tue, 18 Dec 2007 00:22:09 +0100 (CET) Received: by ice.42.org (Postfix, from userid 1000) id 7CA3EB842; Tue, 18 Dec 2007 00:25:09 +0100 (CET) Date: Tue, 18 Dec 2007 00:25:08 +0100 From: Stefan `Sec` Zehl To: zsh-workers@sunsite.dk Subject: Can't change stty settings with zle running Message-ID: <20071217232508.GA71596@ice.42.org> X-Current-Backlog: 2542 messages Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i I-love-doing-this: really X-Modeline: vim:set ts=8 sw=4 smarttab tw=72 si noic notitle: Accept-Languages: de, en X-URL: http://sec.42.org/ X-Virus-Scanned: ClamAV using ClamSMTP Hi, I was trying to change a stty setting from within a signal handler: I used this function TRAPINFO(){ echo -n pid=$$ tty=`tty` `ttyctl` zle && echo ", zle running" || echo ", zle NOT running" stty -a|&grep \ erase stty gfmt1:erase=7f stty -a|&grep \ erase } When i send a sigINFO from another (important!) shell to this one, I get the following output: | ice:~>pid=2414 tty=/dev/ttyp1 tty is not frozen, zle running | eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; | eol2 = ; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U; but if I check the stty settings afterwards, they are reset back: | ice:~>stty -a|grep \ erase | eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; Ok. After some experimenting, I now understand, that this happens because zle is running at that moment. You can see that zle is the culprit, because if i "kill -INFO $$" from within the same shell, it works fine: | ice:~>kill -INFO $$ | pid=2414 tty=/dev/ttyp1 tty is not frozen, zle NOT running | eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; | eol2 = ; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U; | ice:~>stty -a|grep \ erase | eol2 = ; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U; On reading the zshzle manpage, i found "zle -I" which looked very promising. But unfortunately it doesn't help: TRAPINFO(){ zle -I echo -n pid=$$ tty=`tty` `ttyctl` zle && echo ", zle running" || echo ", zle NOT running" stty -a|&grep \ erase stty gfmt1:erase=7f stty -a|&grep \ erase zle -R } running "kill -INFO 2414" from another shell again: | ice:~> | pid=2414 tty=/dev/ttyp1 tty is not frozen, zle running | eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; | eol2 = ; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U; | ice:~>stty -a|grep \ erase | eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; results in an improved display, but the stty settings are still overwritten. Is it possible to fix zle -I so stty changes will be honored? Or is there another sane[1] way to do what I want? Oh, btw. I am running: | ice:~>echo $ZSH_VERSION | 4.3.4 Thanks, Sec [1] I managed to work around this problem by defining preexec in my signal handler and doing the stty change there, and then undefining preexec again -- This feels very much like "the wrong way". -- Dopeler effect: the tendency of stupid ideas to seem smarter when they come at you rapidly.