Gentoo Archives: gentoo-alt

From: Perry Smith <pedzsan@×××××.com>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Patch for openssl config script -- but not really
Date: Thu, 23 Dec 2010 17:15:53
Message-Id: E4A0CD6F-94A8-471B-8518-B3E3B8A4EF51@gmail.com
In Reply to: Re: [gentoo-alt] Patch for openssl config script -- but not really by Fabian Groffen
On Dec 23, 2010, at 8:32 AM, Fabian Groffen wrote:

> On 23-12-2010 08:26:32 -0600, Perry Smith wrote: >> On Dec 23, 2010, at 8:10 AM, Fabian Groffen wrote: >>> It should be IIRC, based on FEATURES=interactive. Anyway, if /bin/sh is >>> an issue on AIX, perhaps we better run their configure script with >>> Prefix'/bootstrap's bash instead? >> >> Seems like to get any type of wide spread stability between platforms and >> releases, you would want to use as few native elements as possible. So, > > We try to do this as much as is reasonable. I think haubi backed up > most of that :) Prefix is indeed fully self-containing for this reason, > although on other platforms this may feel like a complete waste. > >> using a bash that you have control over seems wise in the long term. The >> question is if this config script uses anything in ksh that isn't in bash. I would >> assume not since many /bin/sh's point to bash on other platforms (mac for >> example). >> >> The other thing is to be sure that the shell knows that it is running a script >> and is not interactive. If you passed bash the wrong flag, I bet it would >> make the same mistake and read input in raw mode so that the user could >> do command line editing (which you don't want in this case). > > I'm not sure if I understand this well.
When ksh and bash are interactive and especially when the line editing mode is emacs, they put the tty in raw mode (-icanon). That allows the user to type ^P (for example) and call back the last line. If icanon was on, the ^P would be held in the tty code until a return is hit. I believe with vi mode, ksh sets EOL or maybe EOL2 to escape and that works since any of the vi mode editing starts with an escape. The script from open ssl thinks it can set -icanon, vmin, and vtime and get a 5 second delay but that doesn't work because ksh sets it own tty settings at some point (either between commands or perhaps when it sees the read statement) because I guess it wants to give the user the ability to do line editing. I produced this script as an example: #! set -o set +o vi set +o viraw echo After set -o echo " You have ~5 seconds to press Ctrl-C to abort." (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1 I ran this with "ksh ./temp.sh" With my user id, the first set -o said that vi and viraw were both turned on. I removed my .profile and .kshrc and that still happened. So, this must be some hard wired default with AIX. I also tried this on two different levels of 5.3 with the same results. Before I put the set +o vi and set +o viraw, it would not work (it would hang forever). I'm not a ksh type person so I don't know if this is unique to AIX or not. I tried the same sort of thing with bash and I could not get bash to fail no matter what (even passing the -i flag it still worked). So, it would appear that bash will always work. I hope all that helps. pedz