Gentoo Archives: gentoo-dev

From: Roy Marples <roy@×××××××.name>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Detecting Baselayout2/OpenRC from init.d scripts (summary of debate and plans from bug 270646)
Date: Mon, 08 Jun 2009 10:00:20
Message-Id: 4A2CE12E.70609@marples.name
In Reply to: Re: [gentoo-dev] Detecting Baselayout2/OpenRC from init.d scripts (summary of debate and plans from bug 270646) by "Robin H. Johnson"
1 Robin H. Johnson wrote:
2 > On Mon, Jun 08, 2009 at 12:00:59AM +0100, Roy Marples wrote:
3 >>> Roy: [[ or [?
4 >> Entirely depends on system.
5 >> OpenRC uses /bin/sh to process the actual init script. We rely on /bin/sh
6 >> claiming POSIX compat [1]. On Gentoo Linux systems, this is normally a link
7 >> to bash, so you can use bashisms if you so wish.
8 > Is "[[" a bashism or not? That's all I'm asking.
9 > What's a good way to test for POSIX compatibility so that the testing
10 > CAN actually be done. My testcase was 'bash --posix'. Testing under
11 > busybox's ash seems to work perfectly with "[[" as well.
12
13 bash(1) only documents the --posix option to modify how bash starts up.
14 It does not mention restricting bash extensions such as [[
15
16 IIRC vapier patched busybox to alias [[ to [, which is worse as you
17 still have to quote correctly as if [ and you don't get the =~ operator
18 from [[.
19
20 >
21 >> But as you asked, here's what the good doc [1] has to say
22 >> The following words may be recognized as reserved words on some
23 >> implementations (when none of the characters are quoted), causing
24 >> unspecified results:
25 >> [[ ]] function select
26 >> In other words, I won/t make any claims whether [[ ]] works in OpenRC.
27 > That doesn't answer if it's a bashism. I interpret that part of the
28 > document to simply be that it's implementation detail is not covered by
29 > the POSIX spec.
30
31 If it's not in the spec, then it has to be an extension. Thus, if bash
32 is extending it then it's a bashism.
33
34 > I'm all for going with something that will work more globally, IFF it
35 > can be easily tested for (on pure Gentoo Linux machines, which is what
36 > most developers are running, because they won't be bothered to test
37 > under G/FBSD or Prefix/OSX etc), vs. just going by what the
38 > specification says.
39
40 The only available shell on Linux that doesn't do anything other than
41 the POSIX spec is dash. However, even that shell is not entirely
42 compliant (a few missing features last I looked).
43
44 >> Just Do What The Fuck You Like, Just Don't Bug Me pretty much somes up my
45 >> attitude right now. Why do I have this attiude? Well, bug #175783 is a very
46 >> good example. It's over two years since I submitted replacement scripts and
47 >> did more besides. It's just like the courier-imap fiasco when
48 >> baselayout-1.12 was touted for stable, but this time I Just Don't Care.
49 > There hasn't been any release of the mysql-init-scripts in 2 years.
50 > It's not that anything contrary to your opinions has been done on that
51 > bug, it's more that I haven't have any specific need to fix that package
52 > yet.
53
54 Other than the need to actually allow mysql to work on Gentoo/FreeBSD.
55 Ah, you've already said that you don't want to run anything other than
56 Linux. Fine, that's your choice, but please hand mysql over to someone
57 who cares about Gentoo running on alternative OS's as you've just
58 demonstrated you just don't care.
59
60 Thanks
61
62 Roy

Replies