FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Alt

 
 
LinkBack Thread Tools
 
Old 12-22-2010, 11:37 PM
Perry Smith
 
Default Patch for openssl config script -- but not really

When my bootstrap process was trying to build openssl-1.0.0c, I got stuck at:

WARNING! If you wish to build 64-bit kit, then you have to
invoke './Configure aix64-cc' *manually*.
You have ~5 seconds to press Ctrl-C to abort

The tty was set with -icanon but I believe the problem is the config script says '#! /bin/sh'. On AIX, /bin/sh is actually ksh and ksh mucks with the tty settings between commands. I changed it to use /bin/bsh directly (see below). This could work but I'm a Gentoo Portage Prefix moron so when I started the bootstrap back up, it re-fetched the openssl package and spoiled my fun. I ended up gently killing the youngest copy of sh from another window and that caused things to get rolling again. This may be something to do with my ksh set up too. I don't use ksh but I might have it set so it defaults to emacs mode rather than vi mode. In any case, the script needs to avoid using ksh (on AIX at least).

diff -c /tmp $f
*** /tmp/config Wed Dec 22 17:50:49 2010
--- ./gpx/portage/dev-libs/openssl-1.0.0c/work/openssl-1.0.0c/config Wed Dec 22 17:51:43 2010
***************
*** 797,803 ****
echo " invoke './Configure aix64-cc' *manually*."
if [ "$TEST" = "false" -a -t 1 ]; then
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
fi
fi
fi
--- 797,803 ----
echo " invoke './Configure aix64-cc' *manually*."
if [ "$TEST" = "false" -a -t 1 ]; then
echo " You have ~5 seconds to press Ctrl-C to abort."
! (trap "stty `stty -g`" 2 0; /bin/bsh -c 'stty -icanon min 0 time 50; read waste') <&1
fi
fi
fi

I hope this helps...

pedz
 
Old 12-23-2010, 05:45 AM
Michael Haubenwallner
 
Default Patch for openssl config script -- but not really

On 12/23/10 01:37, Perry Smith wrote:
> When my bootstrap process was trying to build openssl-1.0.0c, I got stuck at:
>
> WARNING! If you wish to build 64-bit kit, then you have to
> invoke './Configure aix64-cc' *manually*.
> You have ~5 seconds to press Ctrl-C to abort
>
> The tty was set with -icanon but I believe the problem is the config script says '#! /bin/sh'.
> On AIX, /bin/sh is actually ksh and ksh mucks with the tty settings between commands.

I've not seen such problems since I do </dev/null.
Does it help to redirect stdin from /dev/null for you too?

> I changed it to use /bin/bsh directly (see below).
> This could work but I'm a Gentoo Portage Prefix moron so when I started the bootstrap back up,
> it re-fetched the openssl package and spoiled my fun.
> I ended up gently killing the youngest copy of sh from another window and that caused things to get rolling again.
> This may be something to do with my ksh set up too.
> I don't use ksh but I might have it set so it defaults to emacs mode rather than vi mode.
> In any case, the script needs to avoid using ksh (on AIX at least).

Anyway, nice hint, thank you!
/haubi/
--
Michael Haubenwallner
Gentoo on a different level
 
Old 12-23-2010, 01:08 PM
Perry Smith
 
Default Patch for openssl config script -- but not really

On Dec 23, 2010, at 12:45 AM, Michael Haubenwallner wrote:

>
> On 12/23/10 01:37, Perry Smith wrote:
>> When my bootstrap process was trying to build openssl-1.0.0c, I got stuck at:
>>
>> WARNING! If you wish to build 64-bit kit, then you have to
>> invoke './Configure aix64-cc' *manually*.
>> You have ~5 seconds to press Ctrl-C to abort
>>
>> The tty was set with -icanon but I believe the problem is the config script says '#! /bin/sh'.
>> On AIX, /bin/sh is actually ksh and ksh mucks with the tty settings between commands.
>
> I've not seen such problems since I do </dev/null.
> Does it help to redirect stdin from /dev/null for you too?

I'm not sure when you are suggesting to do the redirect. It would cause the stty to fail and the read
would return immediately so it would avoid hanging forever.

I've never seen this before (a configure script that pauses or expects input). Given that Portage is a 'batch' type
concept, maybe the redirect should be part of Portage.

>
>> I changed it to use /bin/bsh directly (see below).
>> This could work but I'm a Gentoo Portage Prefix moron so when I started the bootstrap back up,
>> it re-fetched the openssl package and spoiled my fun.
>> I ended up gently killing the youngest copy of sh from another window and that caused things to get rolling again.
>> This may be something to do with my ksh set up too.
>> I don't use ksh but I might have it set so it defaults to emacs mode rather than vi mode.
>> In any case, the script needs to avoid using ksh (on AIX at least).
>
> Anyway, nice hint, thank you!

I passed this up to the openssl guys too (if I get through their mailer).
 
Old 12-23-2010, 01:10 PM
Fabian Groffen
 
Default Patch for openssl config script -- but not really

On 23-12-2010 08:08:28 -0600, Perry Smith wrote:
> > I've not seen such problems since I do </dev/null.
> > Does it help to redirect stdin from /dev/null for you too?
>
> I'm not sure when you are suggesting to do the redirect. It would cause the stty to fail and the read
> would return immediately so it would avoid hanging forever.
>
> I've never seen this before (a configure script that pauses or expects input). Given that Portage is a 'batch' type
> concept, maybe the redirect should be part of Portage.

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?


--
Fabian Groffen
Gentoo on a different level
 
Old 12-23-2010, 01:26 PM
Perry Smith
 
Default Patch for openssl config script -- but not really

On Dec 23, 2010, at 8:10 AM, Fabian Groffen wrote:

> On 23-12-2010 08:08:28 -0600, Perry Smith wrote:
>>> I've not seen such problems since I do </dev/null.
>>> Does it help to redirect stdin from /dev/null for you too?
>>
>> I'm not sure when you are suggesting to do the redirect. It would cause the stty to fail and the read
>> would return immediately so it would avoid hanging forever.
>>
>> I've never seen this before (a configure script that pauses or expects input). Given that Portage is a 'batch' type
>> concept, maybe the redirect should be part of Portage.
>
> 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,
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).

pedz
 
Old 12-23-2010, 01:32 PM
Fabian Groffen
 
Default Patch for openssl config script -- but not really

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.


--
Fabian Groffen
Gentoo on a different level
 
Old 12-23-2010, 03:54 PM
Michael Haubenwallner
 
Default Patch for openssl config script -- but not really

On 12/23/10 15:32, 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

openssl config indeed is run with /bin/sh - eventually it should
also use CONFIG_SHELL instead.

And for the redirection of stdin from /dev/null: eventually yes,
based upon FEATURES=interactive as well as FEATURES=ebuildshell[1].

[1] http://prefix-launcher.svn.sourceforge.net/viewvc/prefix-launcher/prefix-launcher/trunk/portage/patches/04-ebuildshell.patch?view=markup

/haubi/
--
Michael Haubenwallner
Gentoo on a different level
 
Old 12-23-2010, 04:05 PM
Konstantin Tokarev
 
Default Patch for openssl config script -- but not really

>
> 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?
>

How much simpler was this world if nobody assumed /bin/sh to be bash

--
Regards,
Konstantin
 
Old 12-23-2010, 04:15 PM
Perry Smith
 
Default Patch for openssl config script -- but not really

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
 

Thread Tools




All times are GMT. The time now is 10:45 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org