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