1 |
Robin H. Johnson wrote: |
2 |
> On Mon, Jun 08, 2009 at 12:02:44AM +0200, Ulrich Mueller wrote: |
3 |
>>>>>>> On Sun, 7 Jun 2009, Robin H Johnson wrote: |
4 |
>>> 2. Right now, every init.d script that needs to detection should revbump |
5 |
>>> and change to the following: |
6 |
>>> [[ -f /lib/librc.so -o -f /etc/init.d/sysfs -o -f /libexec/rc/version ]] |
7 |
>> Wasn't the convention for init scripts to use only single square |
8 |
>> brackets, i.e. POSIX shell syntax? |
9 |
> That was raised in the bug as well. My testing was with bash --posix, so |
10 |
> if that doesn't implement POSIX correctly, then yes, we'd need to |
11 |
> change. |
12 |
> |
13 |
> Roy: [[ or [? |
14 |
|
15 |
Entirely depends on system. |
16 |
OpenRC uses /bin/sh to process the actual init script. We rely on |
17 |
/bin/sh claiming POSIX compat [1]. On Gentoo Linux systems, this is |
18 |
normally a link to bash, so you can use bashisms if you so wish. |
19 |
|
20 |
However, on Gentoo FreeBSD systems, or Gentoo Embedded systems that |
21 |
predominately use busybox then the bashisms won't obviously work. So the |
22 |
question becomes, does the init script developer want to support non |
23 |
bash by default systems? |
24 |
|
25 |
Franky, I've given up on trying to enforce anything POSIX related over |
26 |
something else (like say GNU or implementation extensions over an |
27 |
accepted standard). I just don't care. I used to, but developer and user |
28 |
backlash (see the archives) was just too much for me and was one of the |
29 |
resaons why I retired from Gentoo. |
30 |
|
31 |
Just Do What The Fuck You Like, Just Don't Bug Me pretty much somes up |
32 |
my attitude right now. Why do I have this attiude? Well, bug #175783 is |
33 |
a very good example. It's over two years since I submitted replacement |
34 |
scripts and did more besides. It's just like the courier-imap fiasco |
35 |
when baselayout-1.12 was touted for stable, but this time I Just Don't Care. |
36 |
|
37 |
But as you asked, here's what the good doc [1] has to say |
38 |
|
39 |
The following words may be recognized as reserved words on some |
40 |
implementations (when none of the characters are quoted), causing |
41 |
unspecified results: |
42 |
[[ ]] function select |
43 |
|
44 |
In other words, I won/t make any claims whether [[ ]] works in OpenRC. |
45 |
|
46 |
Thanks |
47 |
|
48 |
Roy |
49 |
|
50 |
[1] http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html |