From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id DAA16722 for ; Thu, 9 Nov 1995 03:59:27 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA20832; Wed, 8 Nov 1995 11:16:27 -0500 Resent-Date: Wed, 8 Nov 1995 17:16:48 +0100 (MET) Old-Return-Path: From: pws@ifh.de (Peter William Stephenson) Message-Id: <9511081616.AA09580@sgi.ifh.de> Subject: Bugs with read -q To: zsh-workers@math.gatech.edu (Zsh hackers list) Date: Wed, 8 Nov 1995 17:16:48 +0100 (MET) X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"2lyAI2.0.Q55.QVDem"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/565 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu It was pointed out to me that there are bugs with `read -q' (actually the first one below was pointed out to me and the rest are just notes). 1) `read -q' and `read -k' non-interactively screw up the terminal: potentially any stty setting, by the looks of things. It looks to me like it was trying to restore the tty setting without having the right settings to restore. The patch appears to fix it. Unfortunately the same problem didn't occur for the version of 2.6-beta11-test11 I was running, which is very strange as it was in a previous version of 2.6-beta11-test10 and even a version of 2.5: maybe it was fixed by a patch I applied not yet in the archive. 2) `read -q' interprets typeahead as `n'. `read -k' works correctly, i.e. you get the right character. This may be intentional for cases like spell checking where getquery() is also used (we've even had a discussion about it before, but I can't remember the result). For `read -q' it should either be documented or changed. 3) It seems to me there's rather too much duplication in bin_read() between `read -k' and `read -q'. Probably these should be combined into a subroutine which also replaces getquery(). I think someone had go at improving bits of read not long ago, perhaps they can do something about the last two. This has got all my least favourite features and I don't feel like trying myself. *** Src/builtin.c.ti Tue Nov 7 09:48:32 1995 --- Src/builtin.c Wed Nov 8 16:36:58 1995 *************** *** 4615,4620 **** --- 4615,4622 ---- fflush(stderr); return 1; } + if (!isset(INTERACTIVE)) + gettyinfo(&shttyinfo); /* sort out the number of characters to read */ if (*args && idigit(**args)) { if (!(nchars = atoi(*args))) *************** *** 4804,4809 **** --- 4806,4813 ---- fflush(stderr); return 1; } + if (!isset(INTERACTIVE)) + gettyinfo(&shttyinfo); /* set up the buffer */ readbuf = (char *)zalloc(2); -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.