[prefix][solaris] shell problem in portage/configure

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[prefix][solaris] shell problem in portage/configure

Michael Haubenwallner
Hi,

with solaris /bin/sh, this does not work:
    echo 1 | grep -E ^[[:digit:]]+$

seems that '^' is a command separator here.

/haubi/

portage-egrep.patch (403 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Fabian Groffen-2
On 12-04-2007 10:25:46 +0200, Michael Haubenwallner wrote:
> Hi,
>
> with solaris /bin/sh, this does not work:
>     echo 1 | grep -E ^[[:digit:]]+$

I guess this is Solaris <10?

> seems that '^' is a command separator here.

Committed, looks safer in quotes anyway.  The $ might cause problems for
a non-clever shell as well.

Thanks!


--
Fabian Groffen
Gentoo on a different level
--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Michael Haubenwallner
On Thu, 2007-04-12 at 12:39 +0200, Fabian Groffen wrote:
> On 12-04-2007 10:25:46 +0200, Michael Haubenwallner wrote:
> > Hi,
> >
> > with solaris /bin/sh, this does not work:
> >     echo 1 | grep -E ^[[:digit:]]+$
>
> I guess this is Solaris <10?

exactly, Thanks.

/haubi/

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Fabian Groffen-2
On 12-04-2007 13:15:08 +0200, Michael Haubenwallner wrote:

> On Thu, 2007-04-12 at 12:39 +0200, Fabian Groffen wrote:
> > On 12-04-2007 10:25:46 +0200, Michael Haubenwallner wrote:
> > > Hi,
> > >
> > > with solaris /bin/sh, this does not work:
> > >     echo 1 | grep -E ^[[:digit:]]+$
> >
> > I guess this is Solaris <10?
>
> exactly, Thanks.

I fixed this one or two days ago.  If it's not in the latest portage,
then it'll be in the portage that I'll roll out today.

--
Fabian Groffen
Gentoo on a different level

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Fabrizio Listello
I've found another similar (?) shell problem during compiling of MPlayer.
[...]
>>> Compiling source in
/opt/gentoo/var/tmp/portage/media-video/mplayer-1.0_rc1-r2/work/MPlayer-1.0rc1
...
 * QA Notice: USE Flag 'ppc64' not in IUSE for media-video/mplayer-1.0_rc1-r2
Detected operating system: SunOS
Detected host architecture: i386
Checking for i386-pc-solaris2.11-gcc version ... 4.1.2, ok
[...]
Checking for tga ... no
Checking for DirectFB ... ./configure: syntax error at line 3756:
`_dfb_version=$' unexpected

[...]

And this is the line with the problem:
3756:     _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)

The mplayer configure script uses /bin/sh which is the Bourne shell
and not Bourne-again shell.
I'm proposing to patch the "configure" script with a single line in
ebuild unpack function:

--- mplayer-1.0_rc1-r2.ebuild.mio       2007-04-19 16:33:28.545169753 +0200
+++ mplayer-1.0_rc1-r2.ebuild   2007-04-19 16:32:20.262831061 +0200
@@ -131,5 +131,5 @@
 SLOT="0"
 LICENSE="GPL-2"
-KEYWORDS="~amd64 ~ia64 ~ppc-macos ~x86 ~x86-macos ~x86-solaris"
+KEYWORDS="~amd64 ~ia64 ~ppc-macos ~x86 ~x86-macos"

 pkg_setup() {
@@ -204,8 +204,4 @@
        sed -i -e "s:-O4:-O4 -D__STDC_LIMIT_MACROS:" configure

-       # Solaris /bin/sh fix
-       if [[ ${CHOST} == *-solaris* ]] ; then
-               sed -e "s:^#!.*/bin/sh:#!${EPREFIX}/bin/sh:" -i configure
-       fi
 }


On 4/14/07, Fabian Groffen <[hidden email]> wrote:

> On 12-04-2007 13:15:08 +0200, Michael Haubenwallner wrote:
> > On Thu, 2007-04-12 at 12:39 +0200, Fabian Groffen wrote:
> > > On 12-04-2007 10:25:46 +0200, Michael Haubenwallner wrote:
> > > > Hi,
> > > >
> > > > with solaris /bin/sh, this does not work:
> > > >     echo 1 | grep -E ^[[:digit:]]+$
> > >
> > > I guess this is Solaris <10?
> >
> > exactly, Thanks.
>
> I fixed this one or two days ago.  If it's not in the latest portage,
> then it'll be in the portage that I'll roll out today.
>
> --
> Fabian Groffen
> Gentoo on a different level
>
> --
> [hidden email] mailing list
>
>


--

FList
--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Michael Haubenwallner
On Thu, 2007-04-19 at 16:33 +0200, Fabrizio Listello wrote:

> I've found another similar (?) shell problem during compiling of MPlayer.
> [...]
> >>> Compiling source in
> /opt/gentoo/var/tmp/portage/media-video/mplayer-1.0_rc1-r2/work/MPlayer-1.0rc1
> ...
>  * QA Notice: USE Flag 'ppc64' not in IUSE for media-video/mplayer-1.0_rc1-r2
> Detected operating system: SunOS
> Detected host architecture: i386
> Checking for i386-pc-solaris2.11-gcc version ... 4.1.2, ok
> [...]
> Checking for tga ... no
> Checking for DirectFB ... ./configure: syntax error at line 3756:
> `_dfb_version=$' unexpected
>
> [...]
>
> And this is the line with the problem:
> 3756:     _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)
>
> The mplayer configure script uses /bin/sh which is the Bourne shell
> and not Bourne-again shell.

It is defined that configure-scripts need to work with bourne shells
(/bin/sh). And "$(foo)" is bash (or ksh) style.

Replacing line 3756 like this should work:

-     _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)
+     _dfb_version=`dfb_version $_dfb_major $_dfb_minor $_dfb_micro`

>
>
> I'm proposing to patch the "configure" script with a single line in
> ebuild unpack function:

This is the quick&dirty hack, the goal should be to fix the origin of
that line:
*) maybe configure.in, then it should be reported upstream,
*) maybe a patch already in the tree, then fix that patch.

>
> --- mplayer-1.0_rc1-r2.ebuild.mio       2007-04-19 16:33:28.545169753 +0200
> +++ mplayer-1.0_rc1-r2.ebuild   2007-04-19 16:32:20.262831061 +0200
> @@ -131,5 +131,5 @@
>  SLOT="0"
>  LICENSE="GPL-2"
> -KEYWORDS="~amd64 ~ia64 ~ppc-macos ~x86 ~x86-macos ~x86-solaris"
> +KEYWORDS="~amd64 ~ia64 ~ppc-macos ~x86 ~x86-macos"
>
>  pkg_setup() {
> @@ -204,8 +204,4 @@
>         sed -i -e "s:-O4:-O4 -D__STDC_LIMIT_MACROS:" configure
>
> -       # Solaris /bin/sh fix
> -       if [[ ${CHOST} == *-solaris* ]] ; then
> -               sed -e "s:^#!.*/bin/sh:#!${EPREFIX}/bin/sh:" -i configure
> -       fi

Maybe setting CONFIG_SHELL=${EPREFIX}/bin/bash could work too ?

/haubi/

>  }
>
>
> On 4/14/07, Fabian Groffen <[hidden email]> wrote:
> > On 12-04-2007 13:15:08 +0200, Michael Haubenwallner wrote:
> > > On Thu, 2007-04-12 at 12:39 +0200, Fabian Groffen wrote:
> > > > On 12-04-2007 10:25:46 +0200, Michael Haubenwallner wrote:
> > > > > Hi,
> > > > >
> > > > > with solaris /bin/sh, this does not work:
> > > > >     echo 1 | grep -E ^[[:digit:]]+$
> > > >
> > > > I guess this is Solaris <10?
> > >
> > > exactly, Thanks.
> >
> > I fixed this one or two days ago.  If it's not in the latest portage,
> > then it'll be in the portage that I'll roll out today.
> >
> > --
> > Fabian Groffen
> > Gentoo on a different level
> >
> > --
> > [hidden email] mailing list
> >
> >
>
>
> --
>
> FList

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Fabian Groffen-2
On 19-04-2007 17:30:27 +0200, Michael Haubenwallner wrote:
> > And this is the line with the problem:
> > 3756:     _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)
> >
> > The mplayer configure script uses /bin/sh which is the Bourne shell
> > and not Bourne-again shell.
>
> It is defined that configure-scripts need to work with bourne shells
> (/bin/sh). And "$(foo)" is bash (or ksh) style.

true

> Replacing line 3756 like this should work:
>
> -     _dfb_version=$(dfb_version $_dfb_major $_dfb_minor $_dfb_micro)
> +     _dfb_version=`dfb_version $_dfb_major $_dfb_minor $_dfb_micro`

agree

> > -       # Solaris /bin/sh fix
> > -       if [[ ${CHOST} == *-solaris* ]] ; then
> > -               sed -e "s:^#!.*/bin/sh:#!${EPREFIX}/bin/sh:" -i configure
> > -       fi
>
> Maybe setting CONFIG_SHELL=${EPREFIX}/bin/bash could work too ?

Ahhh... anyone have objections on setting this in the profiles?  It
would just make any configure package use bash from the prefix, instead
of /bin/sh, which feels somehow a bit safer, even though it should work
fine in theory.

--
Fabian Groffen
Gentoo on a different level

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem in portage/configure

Johan Hattne

On May 4, 2007, at 22:13 , Fabian Groffen wrote:

> On 19-04-2007 17:30:27 +0200, Michael Haubenwallner wrote:
>>> -       # Solaris /bin/sh fix
>>> -       if [[ ${CHOST} == *-solaris* ]] ; then
>>> -               sed -e "s:^#!.*/bin/sh:#!${EPREFIX}/bin/sh:" -i  
>>> configure
>>> -       fi
>>
>> Maybe setting CONFIG_SHELL=${EPREFIX}/bin/bash could work too ?
>
> Ahhh... anyone have objections on setting this in the profiles?  It
> would just make any configure package use bash from the prefix,  
> instead
> of /bin/sh, which feels somehow a bit safer, even though it should  
> work
> fine in theory.

This would fix the slight annoyance where the autoconf test for  
portage-flex crashes due a broken pipe.  echo '%%\n%%' | flex breaks  
with /bin/sh (bash 2.05) but not with portage bash 3.2.15(1).

... even though this is a problem of flex, not bash.  It's corrected  
upstream.

// Johan

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem inportage/configure

Michael Haubenwallner
In reply to this post by Fabian Groffen-2
On Fri, 2007-05-04 at 22:13 +0200, Fabian Groffen wrote:
> On 19-04-2007 17:30:27 +0200, Michael Haubenwallner wrote:
<snip>
> >
> > Maybe setting CONFIG_SHELL=${EPREFIX}/bin/bash could work too ?
>
> Ahhh... anyone have objections on setting this in the profiles?  It
> would just make any configure package use bash from the prefix, instead
> of /bin/sh, which feels somehow a bit safer, even though it should work
> fine in theory.

For AIX, most users really want prefix-bash for performance reasons.

For others like Solaris, the question is:
Are we willing to test/debug/fix/upstream-report such bugs ?

If we are, then we should keep using /bin/sh.
If not, then we want to use prefix-bash.

One thing to keep in mind: Who else if not prefix-portage has that power
to test/debug/fix such upstream bugs on that range of platforms ?

Using prefix-bash can always be the quick workaround for such bugs, if
one does not have time to debug immediately - let the user choose!

So maybe we want some FEATURE, or simply introduce users on how to set
CONFIG_SHELL in etc/profile.bashrc, to switch between /bin/sh and
prefix-bash (defaulting to prefix-bash for aix, to /bin/sh for others) ?

/haubi/


--
Salomon Automation GmbH - Friesachstrasse 15 - A-8114 Friesach bei Graz
Sitz der Gesellschaft: Friesach bei Graz
UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K
Firmenbuchgericht: Landesgericht für Zivilrechtssachen Graz

--
[hidden email] mailing list

Reply | Threaded
Open this post in threaded view
|

Re: [prefix][solaris] shell problem inportage/configure

Fabian Groffen-2
On 07-05-2007 09:59:02 +0200, Michael Haubenwallner wrote:

> On Fri, 2007-05-04 at 22:13 +0200, Fabian Groffen wrote:
> > On 19-04-2007 17:30:27 +0200, Michael Haubenwallner wrote:
> <snip>
> > >
> > > Maybe setting CONFIG_SHELL=${EPREFIX}/bin/bash could work too ?
> >
> > Ahhh... anyone have objections on setting this in the profiles?  It
> > would just make any configure package use bash from the prefix, instead
> > of /bin/sh, which feels somehow a bit safer, even though it should work
> > fine in theory.
>
> For AIX, most users really want prefix-bash for performance reasons.
>
> For others like Solaris, the question is:
> Are we willing to test/debug/fix/upstream-report such bugs ?

You have to stop support crappy stuff at some moment.  If it's old
enough, no more energy should be put into working with such things, IMO.

> If we are, then we should keep using /bin/sh.
> If not, then we want to use prefix-bash.
>
> One thing to keep in mind: Who else if not prefix-portage has that power
> to test/debug/fix such upstream bugs on that range of platforms ?

Many, many, many others.  But they usually tend to just workaround the
problem in a way that "works for them" to get the desired binary.

> Using prefix-bash can always be the quick workaround for such bugs, if
> one does not have time to debug immediately - let the user choose!
>
> So maybe we want some FEATURE, or simply introduce users on how to set
> CONFIG_SHELL in etc/profile.bashrc, to switch between /bin/sh and
> prefix-bash (defaulting to prefix-bash for aix, to /bin/sh for others) ?

While prefix bash may be faster/better on AIX, on darwin and sunos
/bin/sh is much faster (it's nearly 6 times smaller).  Point here is
that I think you should either do it, or not do it.  If AIX is
inherently broken, then on AIX we use prefix bash.  If on Solaris we use
/bin/sh, we should avoid working around it (such as in gcc ebuild) to
keep it clean.  Either it sucks, or it does not.

BTW, on most Linuxes today there is no /bin/sh, but only bash, so
actually on Linux we better use prefix-bash, simply because we have that
one under control, and using /bin/sh is just using a bash that we don't
know.

--
Fabian Groffen
Gentoo on a different level
--
[hidden email] mailing list