From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25550 invoked by alias); 26 Jun 2012 09:33:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30532 Received: (qmail 13055 invoked from network); 26 Jun 2012 09:33:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 26 Jun 2012 10:33:14 +0100 From: Peter Stephenson To: zsh workers Subject: Re: crashes when setting COLUMNS=0 or 1 Message-ID: <20120626103314.61c6567b@pwslap01u.europe.root.pri> In-Reply-To: <120626003042.ZM19270@torch.brasslantern.com> References: <20120626033802.GA3066@primenet.com.au> <120626000311.ZM19019@torch.brasslantern.com> <120626003042.ZM19270@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.18] X-Scanned-By: MailControl 7.7.2 (www.mailcontrol.com) on 10.71.0.142 On Tue, 26 Jun 2012 00:30:42 -0700 Bart Schaefer wrote: > So, interesting side-effect: If my patch for IPDEF5 is applied, then > settings of COLUMNS and LINES get propagated through to the tty driver > and can end up affecting the behavior of the parent shell (or anything > else that's using the terminal where those values were changed), even > after the shell where the assignments were made has exited. > > E.g. (COLUMNS=20) in a subshell will change the tty driver which will > signal the parent shell which will pick up the change and set its own > column width to 20. This is the only case I can think of where a > parameter assigned in a subshell can behave this way. That's not necessarily always a problem. The parent is in case subject to such changes asynchronously via SIGWINCH. The fact that it's getting the value a different way shouldn't make matters worse in general. Where it's unhelpful is if you're setting COLUMNS not because anything has changed but as a temporary trick for some utility that tests it and truncates. Then you wouldn't want the change to propagate back. This is going to be niggling if it means these two have different effects: COLUMNS=20 ls (export COLUMNS=20; ls) since they look as if they ought to be similar. Howeve, I'm not sure what can reasonably be done. Restoring COLUMNS on exit from a subshell doesn't seem a particularly clean thing to do, but might work in most cases. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog