Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 342399 - x11-apps/xinit: /etc/init.d/functions.sh require bash with baselayout-1
Summary: x11-apps/xinit: /etc/init.d/functions.sh require bash with baselayout-1
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-23 23:26 UTC by Faustus
Modified: 2011-03-08 12:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Faustus 2010-10-23 23:26:41 UTC
In /etc/X11/startDM.sh:

  . /etc/init.d/functions.sh

But /etc/X11/startDM.sh has "#!/bin/sh", so this fails when /bin/sh does not point to bash.

Now, I do not understand completely when the x: line in the default /etc/inittab gets invoked and when it doesn't, but this can't be good when it does.
Comment 1 Chris Coleman 2010-10-23 23:44:45 UTC
(In reply to comment #0)
> In /etc/X11/startDM.sh:
> 
>   . /etc/init.d/functions.sh
> 
> But /etc/X11/startDM.sh has "#!/bin/sh", so this fails when /bin/sh does not
> point to bash.

I'm afraid to try it, but I think that pointing /bin/sh to something other than bash might break lots of other things too.

> Now, I do not understand completely when the x: line in the default
> /etc/inittab gets invoked and when it doesn't, but this can't be good when it
> does.

It gets invoked when /etc/init.d/xdm runs `telinit a`. It works well as long as /bin/sh points to bash.

Gentoo makes fairly heavy use of bash. Most Gentoo systems have /bin/sh as a symlink to /bin/bash.

The idea of being shell neutral is good sometimes, but not necessarily here. Everything is designed to work with bash. Bash has some nice features that other shells don't have.
Comment 2 Faustus 2010-10-23 23:53:57 UTC
> I'm afraid to try it, but I think that pointing /bin/sh to something other than bash might break lots of other things too.

It doesn't. Search for "dash" on this bugzilla, there are just a couple of problems (mainly during build time, not deployment) that are worked out.

> The idea of being shell neutral is good sometimes, but not necessarily here.
> Everything is designed to work with bash. Bash has some nice features that
> other shells don't have.

Your assumptions are incorrect. Gentoo uses #!/bin/bash when necessary.
Comment 3 Chris Coleman 2010-10-24 00:12:22 UTC
(In reply to comment #2)
> > I'm afraid to try it, but I think that pointing /bin/sh to something other than bash might break lots of other things too.
> 
> It doesn't. Search for "dash" on this bugzilla, there are just a couple of
> problems (mainly during build time, not deployment) that are worked out.

Oh, cool. I've heard of dash but never tried it.

> > The idea of being shell neutral is good sometimes, but not necessarily here.
> > Everything is designed to work with bash. Bash has some nice features that
> > other shells don't have.
> 
> Your assumptions are incorrect. Gentoo uses #!/bin/bash when necessary.
> 

I think you may be right. I was presuming that almost all Gentoo users used bash. Not necessarily as their user shell, but certainly as their /bin/sh symlink.

I'm going to try dash.
Comment 4 Chris Coleman 2010-10-24 00:35:59 UTC
(In reply to comment #3)
> I'm going to try dash.

I just tried dash and it seems to support '.' (but not its alias 'source'). So

. /etc/init.d/functions.sh

works in dash.
Comment 5 Chris Coleman 2010-10-24 00:37:28 UTC
I was using version 0.5.5.1.7.
Comment 6 Faustus 2010-10-24 00:41:04 UTC
The problem is not with . vs source, the problem is that /etc/init.d/functions.sh needs bash. If /etc/init.d/functions.sh is necessary, then /etc/X11/startDM.sh should really have the #!/bin/bash shebang. Whether functions.sh are really necessary for startDM.sh, I don't know.
Comment 7 Chris Coleman 2010-10-24 00:57:52 UTC
(In reply to comment #6)
> The problem is not with . vs source, the problem is that
> /etc/init.d/functions.sh needs bash. If /etc/init.d/functions.sh is necessary,
> then /etc/X11/startDM.sh should really have the #!/bin/bash shebang. Whether
> functions.sh are really necessary for startDM.sh, I don't know.
> 

For me, dash has no trouble with /etc/init.d/functions.sh. I can do this:

chris@prism ~ $ dash
$ . /etc/init.d/functions.sh
$ echo $RC_GOT_FUNCTIONS
yes
$ rc_runlevel
default
Comment 8 Faustus 2010-10-24 01:07:45 UTC
Maybe it's because you are using baselayout-2?

For me (dash 0.5.5.1.2, baselayout 1.12.13):

# . /sbin/functions.sh
/sbin/functions.sh: 7: [[: not found
/sbin/functions.sh: 10: declare: not found
/sbin/functions.sh: 11: declare: not found
/sbin/functions.sh: 87: [[: not found
/sbin/functions.sh: 87: [[: not found
/sbin/functions.sh: 96: [[: not found
/sbin/functions.sh: 104: [[: not found
/sbin/functions.sh: 706: Syntax error: Bad for loop variable
Comment 9 Chris Coleman 2010-10-24 01:26:22 UTC
(In reply to comment #8)
> Maybe it's because you are using baselayout-2?
> 
> For me (dash 0.5.5.1.2, baselayout 1.12.13):
> 
> # . /sbin/functions.sh
> /sbin/functions.sh: 7: [[: not found
> /sbin/functions.sh: 10: declare: not found
> /sbin/functions.sh: 11: declare: not found
> /sbin/functions.sh: 87: [[: not found
> /sbin/functions.sh: 87: [[: not found
> /sbin/functions.sh: 96: [[: not found
> /sbin/functions.sh: 104: [[: not found
> /sbin/functions.sh: 706: Syntax error: Bad for loop variable
> 

I am running baselayout-2. My system is ~amd64.

Bug reports here on Gentoo are usually presumed to be from ~arch users. Dash support is, I guess, a feature that hasn't trickled down to stable yet. But be patient. Or switch to ~arch.

I recommend that you switch to ~arch.
Comment 10 Faustus 2010-10-24 01:53:13 UTC
Frankly, in 6 years of using Gentoo I never had an issue with reporting bugs in stable packages.
Comment 11 Chris Coleman 2010-10-24 02:44:54 UTC
(In reply to comment #10)
> Frankly, in 6 years of using Gentoo I never had an issue with reporting bugs in
> stable packages.

That's good. I've been using Gentoo since 2004 too. But I have had some issues reporting bugs in stable packages.

See bug #338137.

I went mad over that one. I wish I had never reported it.
Comment 12 Chris Coleman 2010-10-24 03:04:06 UTC
Sometimes bugs are fixed in ~arch, but then those changes have to go without bug reports for 30 days before they make it into stable arch.
Comment 13 Tomáš Chvátal (RETIRED) gentoo-dev 2011-03-08 12:08:58 UTC
This bug is sadly fixed by using openrc/baselayout-2. It indeed is broken with baselayout-1.

I would recommend proding on the stablebug for baselayout-2 to tell them to finally stabilise it... (nothing for us to fix, works in ~)