zsh-workers
 help / color / mirror / code / Atom feed
* Bugs with read -q
@ 1995-11-08 16:16 Peter William Stephenson
  1995-11-08 18:30 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Peter William Stephenson @ 1995-11-08 16:16 UTC (permalink / raw)
  To: Zsh hackers list

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 <pws@ifh.de>       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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bugs with read -q
  1995-11-08 16:16 Bugs with read -q Peter William Stephenson
@ 1995-11-08 18:30 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1995-11-08 18:30 UTC (permalink / raw)
  To: Peter William Stephenson; +Cc: zsh-workers

Peter wrote:
> 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.

Really stange.  Beta10 does not have this bug.  I thought it was fixed long
ago.  I think the fix was in art. 6142 from Dave Sainty.  Peter's patch to
delay terminal and termcap setup (art. 479) may be related to this.  That's
included with test12 but not in test11.

Bye,

  Zoltan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-11-08 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-08 16:16 Bugs with read -q Peter William Stephenson
1995-11-08 18:30 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).