On Tue, 25 Jan 2005, Andy Polyakov wrote:

I was building the current OpenSSL_0_9_7-stable branch on my Solaris 8
box and noticed after running config my terminal kept scrolling
......
[EMAIL PROTECTED] 52%
Use "logout" to logout.
[EMAIL PROTECTED] 52%
Use "logout" to logout.
......

I tracked it down to this line.
(stty -icanon min 0 time 50; read waste) < /dev/tty

Huh? Just for the record. That line actually originated on Solaris for a *long* time ago... And it was in use on several platforms since then... So how come the problem arises now? What is your shell?

It arises now because I'm now using gcc 3.4.3 (was 2.95.2) on a 64bit machine. I'm using the C shell.


Changing the stty values and not putting them back is unacceptable.

Well, the original intention was/is to rely upon your shell [the one that gives you prompt] to do that, to save and restore stty settings that is. At the very least those I've tested do save and scrupulously restore them *even* if I kill ./config script with -KILL signal without giving it a chance to clean up. Your shell is the only one who can do proper job in either case, so what's the point to do something which will always be half-hearted [as we can't catch -KILL in ./config to restore stty settings]? One should rather wonder how come your shell failed to do its job...

I don't know what systems you tested, but no UNIX/Linux system I've ever used would save tty values prior to executing a shell script and then restore them once the script finished. That is the job of the script.

I've got Solaris 8, various flavors of Linux, UnixWare, OpenServer,
and OpenBSD 3.3 here.

I simple test
.....
$ uname -a
SunOS sun1 5.8 Generic_117350-16 sun4u sparc SUNW,Ultra-5_10
$ echo $0
/bin/sh
$ cat > /tmp/x
:
(stty -icanon min 0 time 50; read waste) < /dev/tty
^D
$ stty -a > /tmp/1
$ sh /tmp/x
$ stty -a > /tmp/2
$ diff /tmp/1 /tmp/2
3a4
min = 0; time = 50;
5c6
< eof = ^d; eol = <undef>; eol2 = <undef>; swtch = <undef>;
---
eof = <undef>; eol = 2; eol2 = <undef>; swtch = <undef>;
11c12
< isig icanon -xcase echo echoe echok -echonl -noflsh
---
isig -icanon -xcase echo echoe echok -echonl -noflsh
$
.....


Something like this is more appropriate.

STTY=`stty -g`
trap "stty $STTY" 2
(stty -icanon min 0 time 50; read waste) < /dev/tty
stty $STTY

Have you wondered why is "< /dev/tty" there? Because standard input in that particular place is a pipe, something you can't pull stty upon. So that suggested addition does exactly nothing:-) But once again, one should rather
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Another test
.....
$ stty -a > /tmp/1
$ cat >/tmp/x
STTY=`stty -g`
trap "stty $STTY" 2
(stty -icanon min 0 time 50; read waste) < /dev/tty
stty $STTY
$ sh /tmp/x
$ stty -a > /tmp/2
$ diff /tmp/1 /tmp/2
$
.....

[or first] wonder [and figure out] how come your shell failed to do its job. Is it bug in your shell or is it some rare circumstances? If former, then it's somebody else's problem, if latter, then we have to understand the circumstances to see what's the proper way to address the problem. Cheers. A.
______________________________________________________________________

-- Tim Rice Multitalents (707) 887-1469 [EMAIL PROTECTED]


______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]

Reply via email to