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