Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 175783 - dev-db/mysql-init-scripts: convert to POSIX for use with dash/etc... and openrc
Summary: dev-db/mysql-init-scripts: convert to POSIX for use with dash/etc... and openrc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Highest enhancement with 1 vote (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
: 166606 173057 289970 299130 (view as bug list)
Depends on:
Blocks: 173057
  Show dependency tree
 
Reported: 2007-04-24 00:51 UTC by Bjarke Istrup Pedersen (RETIRED)
Modified: 2013-01-18 01:51 UTC (History)
24 users (show)

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


Attachments
mysql init script (mysql,1.71 KB, text/plain)
2007-05-24 15:55 UTC, Roy Marples (RETIRED)
Details
Add ewaitfile to openrc (ewaitfile.diff,2.60 KB, patch)
2008-06-02 15:49 UTC, Roy Marples
Details | Diff
Use ewaitfile (mysql-initd.diff,994 bytes, patch)
2009-05-17 13:40 UTC, Davide Pesavento
Details | Diff
POSIX-compatible init script (mysql,1.85 KB, text/plain)
2010-06-18 14:01 UTC, Davide Pesavento
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2007-04-24 00:51:30 UTC
When using baselayout-2 on Gentoo/FreeBSD, mysql fails to start with the 
following error:

# /etc/init.d/mysql start
 * Caching service dependencies ...
/etc/init.d/mysql: 9: Syntax error: "(" unexpected
/etc/init.d/mysqlmanager: 14: Syntax error: "(" unexpected                      
                                       [ ok ]
/etc/init.d/mysql: 9: Syntax error: "(" unexpected
 * ERROR: mysql failed to start
Comment 1 Roy Marples (RETIRED) gentoo-dev 2007-05-24 15:55:29 UTC
Created attachment 120196 [details]
mysql init script

Then then. The current scripts try to re-invent too many wheels. baselayout has supported the concept of multiplexing for some time. link the scripts to mysql to do this like so
ln -s mysql /etc/init.d/mysql.foo
Then MY_CNF will default to /etc/mysql.foo/my.cnf.

This new script is very simple and should work just fine. Any special args should be placed in /etc/conf.d/mysql like so

MY_CNF="/etc/myfoo/my.cnf" (defaults to /etc/mysql/my.cnf)
MY_ARGS="--optionone=1--optiontwo=2"
Comment 2 Roy Marples (RETIRED) gentoo-dev 2007-05-24 16:01:35 UTC
Oh yes - what's the mysqlmanager script for? I've not touched that as it seems pointless?
Comment 3 Roy Marples (RETIRED) gentoo-dev 2007-08-08 02:22:59 UTC
*** Bug 166606 has been marked as a duplicate of this bug. ***
Comment 4 Roy Marples (RETIRED) gentoo-dev 2007-08-08 02:24:17 UTC
I for one won't let this hold up baselayout-2
Comment 5 Davide Pesavento gentoo-dev 2007-09-27 21:45:39 UTC
Is someone going to fix this one?
Comment 6 Jonathan Dehan 2008-02-19 21:05:18 UTC
Please commit the script!
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2008-03-20 16:38:38 UTC
Well seriously WTH is up with this?
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-03-22 03:30:59 UTC
roy: you wrote this, and there's one critical problem with it.

MySQL should NOT be considered up until the socket comes into existence at /var/run/mysqld/mysqld.sock.

Depending on the size of your databases, this can be anywhere from 0 to ~60 seconds after the process has been backgrounded by s-s-d. If the init script returns success right away, and the next thing that tries to start wants to use the socket, then it's going to fail.

In the previous edition of the scripts, we looped checking for that socket - should that logic come back, or can you suggest a better way?
Comment 9 Roy Marples 2008-03-22 08:06:05 UTC
Fix mysql to create the socket before daemonising?
But aside from the proper fix, no I don't have any other ideas at this time. If other daemons have the same flaw, then maybe a function could be created

ewaitfile /var/run/mysqld/mysqld.sock 60

Give it 60 seconds to create the socket.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-03-22 21:05:31 UTC
roy: mysql doesn't daemonize. ssd does the work itself via --background.

I'd be up for an ewaitfile being provided by baselayout, I certainly do see other cases where it would be a good solution.
Comment 11 Roy Marples 2008-03-23 22:27:29 UTC
OK, maybe adding it to ssd would be the better solution then. However, that won't easily fly for baselayout-1.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-03-23 22:33:43 UTC
How about a fallback in the mysql script, that if a ewaitfile function is not already available, it defines one of it's own?
Comment 13 Roy Marples 2008-03-23 23:00:10 UTC
No, I was thinking about adding it to ssd

start-stop-daemon --waitfile /foo
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-03-23 23:15:20 UTC
here's a trick that should work, but it's a bit unclean.
BTW, is there something better than existence of librc that init.d scripts can check to see if they are running under baselayout2?

=====
[ -e /lib/librc.so ] && opts="${opts} --waitfile foo"
start-stop-daemon ${opts} ...
[ -e /lib/librc.so ] || ewaitfile /foo
=====
Comment 15 Roy Marples 2008-03-23 23:20:11 UTC
Not really no...
I suppose we could export a function
openrcpreq so you could do this

if openrcpreq 1 2; then
  funk new feature
elif openrcpreq 1 0; then
  inital release feature
else
  sol :P
fi
Comment 16 SpanKY gentoo-dev 2008-03-25 17:05:42 UTC
that's pretty ugly as well

we can just add things to baselayout-1.x to ease transition as needed ... ive already been doing this for some time
Comment 17 Roy Marples 2008-06-02 15:49:08 UTC
Created attachment 155247 [details, diff]
Add ewaitfile to openrc

This adds the ewaitfile function to OpenRC.
ewaitfile timeout file1 [file2 ...]
If timeout <1, then we wait forever.

Comments?
Comment 18 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-06-02 18:44:49 UTC
uberlord: looks good, and just in time for final upcoming pass at putting this in the tree. Tell me what version of openrc it goes into, so I can have a suitable RDEPEND entry.
Comment 19 Roy Marples 2008-06-03 12:00:31 UTC
It will go into openrc-0.2.6 which will be cut once bug #224171 is solved - if I can work out wtf is going wrong there :)

In the mean time, feel free to patch 0.2.5 with it if you like as it could be out today or a week or so.
Comment 20 Doug Goldstein (RETIRED) gentoo-dev 2008-10-07 15:49:10 UTC
ewaitfile now exists in 0.3.0.
Comment 21 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-11-14 21:51:36 UTC
*** Bug 173057 has been marked as a duplicate of this bug. ***
Comment 22 Jeremy Murphy 2009-01-02 12:09:37 UTC
Mysql has always started up fine for me until just recently, I presume with the upgrade to openrc 0.4.x (since I run ~amd64).  Does that make sense, or is it meant to be working now?
Comment 23 Davide Pesavento gentoo-dev 2009-03-23 15:59:03 UTC
Ping! What's holding this back?
Comment 24 James Le Cuirot gentoo-dev 2009-04-25 20:39:05 UTC
It looks as though a different fix to the one that was suggested was applied at some point since this is already in the init script. Not sure when this happened.

while ! [[ -S "${socket}" || "${STARTUPTIMEOUT}" -lt 1 || "${retstatus}" -ne 0 ]] ; do
  STARTUPTIMEOUT=$(( STARTUPTIMEOUT - 1 ))
  [[ ${DEBUG} -ge 1 ]] && echo -n "${STARTUPTIMEOUT},"
  sleep ${TIMEUNIT}
done

Something's still not right though. I set the timeout to 15 seconds, which was long enough for MySQL to start without the script reporting a failure but mythbackend seems to give up waiting before its ready. I always have to run "rc" after my system has booted to give it another shot at starting. Maybe this isn't the exact cause but I'm pretty sure MySQL is to blame.
Comment 25 Davide Pesavento gentoo-dev 2009-05-17 13:40:47 UTC
Created attachment 191550 [details, diff]
Use ewaitfile

I've been running Roy's script with the addition of ewaitfile (see attached patch) for quite some time now. No problems so far. I don't have large databases though, so testing from people with some large DBs is appreciated.

The timeout parameter for ewaitfile can be made configurable via conf.d if needed, for now it's hardcoded at 60 seconds.
Comment 26 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-12-21 23:29:26 UTC
If this is still an issue, it is a blocker for openrc stabilization. Marking as so.
Comment 27 James Le Cuirot gentoo-dev 2009-12-22 08:14:58 UTC
My issue has gone, at least. Sorry, forgot about this bug.
Comment 28 William Hubbs gentoo-dev 2010-01-19 03:54:47 UTC
It looks like openrc now includes ewaitfile, so I am closing this bug.  Please re-open if there is still an issue.
Comment 29 Davide Pesavento gentoo-dev 2010-01-19 13:26:40 UTC
(In reply to comment #28)
> It looks like openrc now includes ewaitfile, so I am closing this bug.  Please
> re-open if there is still an issue.
> 

Have you fixed the init script to use ewaitfile? Btw, a revision or version bump would be a good idea IMHO.
Comment 30 Marc Joliet 2010-02-28 22:52:27 UTC
(In reply to comment #29)n> (In reply to comment #28), I> > It looks like openrc now includes ewaitfile, so I am closing this bug.  Please
> > re-open if there is still an issue.
> > 
> 
> Have you fixed the init script to use ewaitfile? Btw, a revision or version
> bump would be a good idea IMHO.
> 

It doesn't appear so:

    marcec marcec # grep ewaitfile /etc/init.d/mysql*
    marcec marcec #

The init-script is provided by dev-db/mysql-init-scripts, which hasn't been
updated since 2007:

    marcec marcec # head /usr/portage/dev-db/mysql-init-scripts/ChangeLog
    # ChangeLog for dev-db/mysql-init-scripts
    # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
    # $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/ChangeLog,v 1.3 2007/04/28 16:58:36 swegener Exp $

      28 Apr 2007; Sven Wegener <swegener@gentoo.org>
      mysql-init-scripts-1.2.ebuild:
      Fix *initd, *confd and *envd calls (#17388, #174266)

Since I still get the error as originally reported by Bjarke Istrup Pedersen, I
think this bug should be reopened (I would myself, but I don't appear to have
the necessary rights).

    marcec marcec # /etc/init.d/mysql status
    /etc/init.d/mysql: 9: Syntax error: "(" unexpected
    marcec marcec # /etc/init.d/mysqlmanager status
    /etc/init.d/mysqlmanager: 14: Syntax error: "(" unexpected
Comment 31 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2010-02-28 22:59:55 UTC
Bug reopened.
Comment 32 Marc Joliet 2010-03-01 08:53:14 UTC
OK, I just wanted to note that the original error (the syntax error) is due to my using dash as /bin/sh. With the symlink pointing to bash instead it works (I just remembered this morning), so sorry about that. This doesn't affect the other issue - the fact that ewaitfile isn't used in the init scripts - in any way, though.
Comment 33 Davide Pesavento gentoo-dev 2010-03-01 10:45:42 UTC
(In reply to comment #32)
> OK, I just wanted to note that the original error (the syntax error) is due to
> my using dash as /bin/sh. With the symlink pointing to bash instead it works (I
> just remembered this morning), so sorry about that. 

Which shell you're using is irrelevant. Init scripts must be POSIX-compliant, i.e. every POSIX-compatible shell should be able to execute them (and dash is POSIX-compatible). If the script uses bashisms, then it must be fixed.
Comment 34 Marc Joliet 2010-03-01 11:50:07 UTC
(In reply to comment #33)
> Which shell you're using is irrelevant. Init scripts must be POSIX-compliant,
> i.e. every POSIX-compatible shell should be able to execute them (and dash is
> POSIX-compatible). If the script uses bashisms, then it must be fixed.

There is in fact already a bug regarding this: 289970 (and perhaps also 299130).
Comment 35 Davide Pesavento gentoo-dev 2010-03-01 13:35:44 UTC
*** Bug 289970 has been marked as a duplicate of this bug. ***
Comment 36 Davide Pesavento gentoo-dev 2010-03-01 13:35:59 UTC
*** Bug 299130 has been marked as a duplicate of this bug. ***
Comment 37 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-06-18 13:22:13 UTC
Any news regarding this topic? Has maybe someone made a script that is actually POSIX sh compatible? If yes please attach it here.
Comment 38 Davide Pesavento gentoo-dev 2010-06-18 14:01:42 UTC
Created attachment 235857 [details]
POSIX-compatible init script

Works for me.
Comment 39 Anthony Basile gentoo-dev 2010-07-10 17:50:18 UTC
I just tested this with the original mysql init, and the attachment in Comment #38.  Both scripts work for me.  I was not able to hit the original bug.

This is an old bug and I'm not sure what might have changed.  I'm using:

sys-apps/baselayout-2.0.1
sys-apps/openrc-0.6.1-r1
dev-db/mysql-5.0.90-r2

Comment 40 Davide Pesavento gentoo-dev 2010-07-10 18:24:06 UTC
I guess /bin/sh is pointing to bash on your system... that's why you can't reproduce the original problem.
Comment 41 Anthony Basile gentoo-dev 2010-07-10 23:34:40 UTC
(In reply to comment #40)
> I guess /bin/sh is pointing to bash on your system... that's why you can't
> reproduce the original problem.
> 

What shell(s) would you recommend testing with?  dash?
Comment 42 Davide Pesavento gentoo-dev 2010-07-11 00:03:06 UTC
(In reply to comment #41)
> (In reply to comment #40)
> > I guess /bin/sh is pointing to bash on your system... that's why you can't
> > reproduce the original problem.
> > 
> 
> What shell(s) would you recommend testing with?  dash?
> 

Yes, dash.
Comment 43 William Hubbs gentoo-dev 2010-07-14 02:47:45 UTC
Since this is a blocker for openrc stabilization, is there any way that
someone can take a look at it soon?

Thanks much,

William

Comment 44 Piotr Karbowski (RETIRED) gentoo-dev 2010-08-07 09:55:37 UTC
Well I does not understand why init scripts aren't written for pure posix SH but for bash. OpenRC for a reason uses /bin/sh not a /bin/bash. I wonder when this bug will be fixed.
Comment 45 SpanKY gentoo-dev 2010-08-07 22:55:51 UTC
POSIX compatibility in init.d scripts is not a blocker for openrc/baselayout-2.  if people have the default of /bin/sh pointing to bash, does current mysql work with openrc ?
Comment 46 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-07 23:18:16 UTC
Quite sure it does work.
Comment 47 Anthony Basile gentoo-dev 2010-08-08 02:16:27 UTC
(In reply to comment #45)
> POSIX compatibility in init.d scripts is not a blocker for openrc/baselayout-2.
>  if people have the default of /bin/sh pointing to bash, does current mysql
> work with openrc ?
> 

It works perfectly fine with sh -> bash.  I was thinking of fixing the minor syntax errors to get it to work with dash, but I really don't see the point.

Close invalid?
Comment 48 SpanKY gentoo-dev 2010-08-08 02:18:08 UTC
thanks, we'll just roll with that assumption.  people have to manually opt into /bin/sh -> dash in the first place by creating the link by hand ... there is nothing like a USE flag combo to trigger this.
Comment 49 SpanKY gentoo-dev 2010-08-08 03:04:44 UTC
there is no hard requirement anywhere that init.d scripts must be POSIX.  it is however generally preferred that packages support it as it does enable people to use a smaller/faster shell, as well as work with embedded systems like busybox.  that is why we treat these bugs as enhancements for when people get around to it, and to encourage users to help out.
Comment 50 Piotr Karbowski (RETIRED) gentoo-dev 2010-08-08 11:52:27 UTC
> there is no hard requirement anywhere that init.d scripts must be POSIX.

Well openrc uses /bin/sh, not /bin/bash so it could be good reason to make all init scripts working on bourne shell.

There is already working init with 'real' /bin/sh, POSIX compatibility, maybe someone can review it and push into mysql-init-scripts?
Comment 51 Francesco Riosa 2010-08-08 13:16:09 UTC
As the original coder of the script may I add some history?

I was the mantainer of MySQL at the time, with overengineered intents to slot dev-db/mysql in 4.0, 4.1 and 5.0.

To make this possible an init script able to start multiple version of mysql was necessary.

At the time I was rather ignorant on init.d/* world and seeked help w/o success from persons which knowed better, no response arrived in circa one month. Obviously at that point I did started to code and hacked it whith some things in mind:

1) possibility to start different (slot) version of mysql
2) possibility to start different mysql of the same version
3) possibility to override /etc/mysql/my.cnf options in /etc/conf.d/mysql
4) don't mark the service started until it's started for good

today:
1) is vastly unneded nowadays
2) useful, some people start one mysql server per cpu or per disk
3) useful but less that in the past, mysql is now good at my.cnf location and parsing (it was not)
4) still needed but `ewait` can be used to wait for the socket instead of some hacked bash

To be honest after some time I did the script there was a suggestion to convert it into the net.* way, it should have been done, but I had already worked a lot on that, and also a cold feeling that if that suggestion was arrived some month before much work coulda been avoided make me (wrongly) decide not to change what already in production.

Suggestion:
bash -> dash mayor incompatibility are arrays, it would seem easy to change the init.d script but the really challenge is the __conf.d__ script by default it's empty but if someone had used it those variables are all arrays and not of the easy ones to convert into delimited string (as it was for /etc/conf.d/net).

So please dont'change the status quo, maybe a "posix" use flag may be added to dev-db/mysql-init-scripts, triggering much simpler script which work similarly to those net.*, w/o the complex conf.d file parsing (except for maybe NICE values). Remember to check for the socket mysql create in any case.

P.S. mysqlmanager -> http://bugs.gentoo.org/114667 don't know if anybody ever used it tough.

P.P.S. I'm avaiable to fix the scripts or to create new ones and to test them, just before to do so I really, really want to know what Gentoo users need, what are the requirements of compatibility and whatever else jump in at the moment.

Comment 52 Piotr Karbowski (RETIRED) gentoo-dev 2010-08-08 14:37:15 UTC
(In reply to comment #51)
> P.P.S. I'm avaiable to fix the scripts or to create new ones and to test them,
> just before to do so I really, really want to know what Gentoo users need, what
> are the requirements of compatibility and whatever else jump in at the moment.

Hi there. About compatibility - if your script will work with dash, it will work with each bourne shell compatible shell. Busybox's ash have some bashines (for example you can use [[ with ash where dash understand only [ like bourne shell).

If you need help or someone to test it, please mail me.
Comment 53 Francesco Riosa 2010-08-08 15:10:06 UTC
(In reply to comment #52)
> (In reply to comment #51)
> > P.P.S. I'm avaiable to fix the scripts or to create new ones and to test them,
> > just before to do so I really, really want to know what Gentoo users need, what
> > are the requirements of compatibility and whatever else jump in at the moment.
> 
> Hi there. About compatibility - if your script will work with dash, it will
> work with each bourne shell compatible shell. Busybox's ash have some bashines
> (for example you can use [[ with ash where dash understand only [ like bourne
> shell).
> 
> If you need help or someone to test it, please mail me.
> 

the other way, see it from the users point of view:

If the script need to work with posix sh there is no way to keep compatibility with the init script which are in portage since 2005

on the other hand possibly very few people use conf.d/mysql (I do not anymore)
Comment 54 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-08-08 18:26:36 UTC
I do use multiple-instance MySQL on the other hand, as they are presently written.

Also, that get_config change w/ needs to take into account any options passed in MY_ARGS (datadir, basedir, pid-file, socket).
Comment 55 Roy Marples 2010-08-08 18:29:35 UTC
(In reply to comment #49)
> there is no hard requirement anywhere that init.d scripts must be POSIX.

That is only true for when Gentoo/Linux is the host platform.
http://www.gentoo.org/proj/en/gentoo-alt/prefix/

Plenty of items listed there where /bin/sh does not default to bash.
I would argue that if projects like Gentoo Prefix have any chance of being successful then POSIX compliance of init scripts should be a hard requirement and maybe enforced by portage before commits.
Comment 56 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-08 18:39:55 UTC
But still it's no regression for Gentoo Linux which happens to be the only project that needs this STABLE.

I'm quite sure the Alt team hasn't changed the policy that they have not to block the Linux side of the development with anything at all.

So once again, this is enhancement and not blocking.
Comment 57 SpanKY gentoo-dev 2010-08-09 06:08:55 UTC
how are prefix platforms relevant if they arent using baselayout init.d scripts

besides, as Diego points out, this is a stable issue and that only applies to Gentoo running Linux
Comment 58 Roy Marples 2010-08-09 07:13:28 UTC
(In reply to comment #57)
> how are prefix platforms relevant if they arent using baselayout init.d scripts

For example launching any daemons installed by portage.
When OpenRC is compiled for /some/path instead of /, then the automatic running of the majority of the installed init.d scripts is disabled by the -prefix keyword.

So, if mysql is installed in a prefix environment via portage then it could still be configured and launched if the standard mysql Gentoo instructions where followed.
Comment 59 SpanKY gentoo-dev 2010-08-09 07:16:38 UTC
unless i missed something, the openrc ebuild doesnt expose that functionality, and it lacks prefix keywords, so it's a moot point
Comment 60 Kai Krakow 2010-08-30 17:18:11 UTC
When is the bashism syntax [[...]] etc going to be fixed? MySQL won't start when using dash as default-sh with baselayout-2.
Comment 61 SpanKY gentoo-dev 2010-08-30 18:05:40 UTC
please refrain from useless comments.  read the bug to figure out the status yourself.  after that, feel free to *contribute* the fixes required to move the bug along, otherwise wait patiently/quietly.
Comment 62 Anthony Basile gentoo-dev 2010-08-31 01:38:43 UTC
(In reply to comment #60)
> When is the bashism syntax [[...]] etc going to be fixed? MySQL won't start
> when using dash as default-sh with baselayout-2.

Please help out.  Here are the bash-ism that I found:

1. [[ ... ]] needs to be replaced by [ ... ].  Trivial

2. Bash arrays like

     srv=( ${srv_slot} ${srv_num} )

need to be replaced everywhere so

     wdebug 3 "srv                ${srv[@]}"

becomes

     wdebug 3 "srv                ${srv_slot} ${srv_num}"


3. At least one redirection variable needs to be replaced:

     local tmp_eval="mysql_slot_${srv_slot}${srv_num:+"_"}${srv_num}[@]"
     local conf_d_parameters="${!tmp_eval}"

The way this works is (for example)

     A="hi"
     B="A"
     echo ${!B}

gives "hi" with !B being replaced by its value A and then A being treated as a bash variable.

There may be more bashisms, but that's what I've got.  I've done part 1, I've 1/2 done part 2, and part 3 is a mess.

Comment 63 Francesco Riosa 2010-08-31 09:42:48 UTC
again, trying to say it with different words:

to remove bashism from init.d/mysql make NO SENSE, because you have users with bashism in CONF.D/mysql.

If /etc/conf.d/mysql is of no worry THEN init.d/mysql should BE REWITTEN in 10 lines of pure posix sh or 20 of i386 assembler whatever you want.
Comment 64 Kai Krakow 2010-08-31 10:38:33 UTC
(In reply to comment #63)
> to remove bashism from init.d/mysql make NO SENSE, because you have users with
> bashism in CONF.D/mysql.

This is probably because the current script tries to handle multi-instance itself while baselayout-2 already supports that out-of-the-box (afaik).

So in a baselayout-2 world we could probably completely remove that feature and stick with a more easy and maintainable init.d script? This would probably what Davide already provided with the attachment dated 2010-06-18.
Comment 65 Francesco Riosa 2010-08-31 11:18:27 UTC
(In reply to comment #64)
> (In reply to comment #63)
> > to remove bashism from init.d/mysql make NO SENSE, because you have users with
> > bashism in CONF.D/mysql.
> 
> This is probably because the current script tries to handle multi-instance
> itself while baselayout-2 already supports that out-of-the-box (afaik).
> 
> So in a baselayout-2 world we could probably completely remove that feature and
> stick with a more easy and maintainable init.d script? This would probably what
> Davide already provided with the attachment dated 2010-06-18.

a) gentoo still is not a pure baselayout-2 world
b) to change the scripts is trivial, to make sure the change will NOT suddently break working installation is not.

reassuming: the change should be pubblicized and documented to avoid broke running systems. 

rewrite the script is easy 

migration is difficult. 

Your efforts, if you want to help, need to be directed into avoiding breakage, possibly writing guide or studing a new dev-db/mysql-init-scripts ebuild that die() if a modified conf.d/mysql is in place.

Comment 66 James Le Cuirot gentoo-dev 2010-08-31 11:31:10 UTC
(In reply to comment #65)
> a) gentoo still is not a pure baselayout-2 world

This will hopefully be the case soon though. There seems to be a new push towards making OpenRC stable. With that in mind, it's probably better to wait than to try and target both now.
Comment 67 Anthony Basile gentoo-dev 2010-08-31 12:29:03 UTC
> rewrite the script is easy 
> migration is difficult. 

Yes and no.  I was looking at the script from the point of view of rewriting it so that it *does not* break backwards compat.  In that case, rewrite is hard and migration is easy.

If we abandon conf.d/mysql, then yes, rewrite is easy, migration hard.
Comment 68 Kai Krakow 2010-08-31 12:52:11 UTC
(In reply to comment #67)
> If we abandon conf.d/mysql, then yes, rewrite is easy, migration hard.

Migration of conf.d to baselayout-2 is no easy task anyway. At least for me it was never straight forward. So I think it would be feasible to take this step for mysql once baselayout-2 goes stable - or even install different init.d scripts based on which baselayout version is detected. One the other hand having two scripts to maintain may sound like a stupid idea but in comment #30 I read it wasn't updated since 2007 anyway - so what about maintenance efforts?
Comment 69 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-12-06 00:45:15 UTC
I have worked on this now, and have it in the MySQL overlay, along with a news item about the required migration. Please test, I hope to move it to the main tree in a week (p.masked) if all is well.

http://git.overlays.gentoo.org/gitweb/?p=proj/mysql.git;a=commitdiff;h=161bb79950395ab6e0d59187e4fd14053505c50d
http://git.overlays.gentoo.org/gitweb/?p=proj/mysql.git;a=commitdiff;h=6beff5532a04274b0d619242fa6dd6a3872c3381
Comment 70 Sven Müller 2012-01-22 21:42:01 UTC
I'm on the way to replace bash by dash to speed up the boot process. But mysql still fails to start. 

How's the current state of that init-script? Is there a chance to expect it to be merged into the mainline portage tree somewhere in the future?
Comment 71 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-01-23 03:49:59 UTC
musv@gmx.de:
Go and use the mysql-init-scripts-2.0_pre1-r2 version.
If you still have a problem with that and dash, open a new bug.

It's also considered good form to CC yourself to a bug when you make a comment expecting a response.
Comment 72 Kai Krakow 2012-02-13 12:27:26 UTC
Version 2.0_pre1-r2 still yields the following with dash:


$ sudo /etc/init.d/mysql start
mysql           | * Caching service dependencies ...                                                                                                                                [ ok ]
mysql           |/lib64/rc/sh/runscript.sh: 282: Bad substitution


So, not resolved...
Comment 73 Julian Ospald 2013-01-16 15:34:03 UTC
dev-db/mysql-init-scripts-2.0_pre1-r2

* QA Notice: shell script appears to use non-POSIX feature(s):
 *    possible bashism in /etc/init.d/mysql line 28 (${!prefix[*|@]):
 *    	local varlist="${!mysql_slot_*} ${!MYSQL_BLOG_PID_FILE*} ${!STOPTIMEOUT*}"
 *    possible bashism in /etc/init.d/mysql line 29 (${parm/?/pat[/str]}):
 *    	varlist="${varlist// /}"
 *    possible bashism in /etc/init.d/mysql line 91 (${parm/?/pat[/str]}):
 *    	start-stop-daemon \
 *    		${DEBUG/*/"--verbose"} \
 *    		--start \
 *    		--exec "${basedir}"/sbin/mysqld \
 *    		--pidfile "${pidfile}" \
 *    		--background \
 *    		--wait ${startup_early_timeout} \
 *    		${tmpnice} \
 *    		${tmpionice} \
 *    		-- --defaults-file="${MY_CNF}" ${MY_ARGS}
 *    possible bashism in /etc/init.d/mysql line 117 (${parm/?/pat[/str]}):
 *    	start-stop-daemon \
 *    		${DEBUG/*/"--verbose"} \
 *    		--stop \
 *    		--exec "${basedir}"/sbin/mysqld \
 *    		--pidfile "${pidfile}" \
 *    		--retry ${stop_timeout}
Comment 74 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-18 01:51:05 UTC
InCVS