Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 283057 - net-wireless/bluez init script uses bashisms
Summary: net-wireless/bluez init script uses bashisms
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High minor (vote)
Assignee: Tiziano Müller (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-28 18:49 UTC by Michał Górny
Modified: 2010-09-07 10:59 UTC (History)
7 users (show)

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


Attachments
Few fixes in init.d script (bluetooth-init.d.diff,1.18 KB, patch)
2009-08-28 19:08 UTC, Michał Górny
Details | Diff
Fixes to hidd initscript (init.d-hidd.diff,773 bytes, patch)
2009-08-28 19:14 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-08-28 18:49:17 UTC
init.d script installed along with net-wireless/bluez uses bashisms and thus is incompatible with more strict shells like dash. As openrc uses /bin/sh to run init.d scripts, the script should be fixed to be at least dash-compliant.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-08-28 19:08:18 UTC
Created attachment 202542 [details, diff]
Few fixes in init.d script

I've made following changes to the init.d script:
* did a retab,
* replaced those ugly tabs within ebegin with eindent,
* removed ${result} changing as even if hid2hci or rfcomm fails, bluetoothd is already running (else user will have to kill the daemon manually to be able to '/etc/init.d/bluetooth start' again),
* replaced final 'eend' with standard 'return' as else we'll get additional '[ok]' with no matching ebegin.

If you want to leave ${result} mangling there, you should use '-eq'; '=' is for strings and '==' is a bashism.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-08-28 19:14:15 UTC
Created attachment 202544 [details, diff]
Fixes to hidd initscript

* moved variable assignments outside 'local' declaration so that fully POSIX-strict shells won't miss them,
* use numerical comparisons for ${result}.
Comment 3 Chris Gianelloni 2009-12-30 19:56:40 UTC
I have an updated version of bluez in my overlay which is using these patches.

Thanks
Comment 4 Gustavo F. Padovan 2010-01-20 04:33:46 UTC
This is fixed on ebuild for bluez-4.60 at bug #270859. Do we need to fix it for 4.39 too?
Comment 5 Pacho Ramos gentoo-dev 2010-02-01 20:13:51 UTC
What is the status of this one with bluez-4.60 ? 
Comment 6 Gustavo F. Padovan 2010-02-01 20:18:35 UTC
(In reply to comment #5)
> What is the status of this one with bluez-4.60 ? 
> 

I need only to apply the init.d-hidd.diff patch to 4.60. I forgot it, sorry.

Comment 7 Pacho Ramos gentoo-dev 2010-02-01 20:26:22 UTC
:-/, commited 4.60 ebuild still uses old scripts for hidd, then, at least that part is still valid
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-11 19:52:58 UTC
The new '4.60/bluetooth-init.d' script once again embeds tab-indent into ebegin instead of using eindent.
Comment 9 William Hubbs gentoo-dev 2010-09-06 20:34:49 UTC
Package's init scripts not being posix compliant should be fixed, but this is not a blocker for openrc stabilization.
Comment 10 Pacho Ramos gentoo-dev 2010-09-07 10:59:29 UTC
+*bluez-4.70 (07 Sep 2010)
+
+  07 Sep 2010; Pacho Ramos <pacho@gentoo.org> -bluez-4.63.ebuild,
+  -bluez-4.64.ebuild, -bluez-4.67.ebuild, +bluez-4.70.ebuild,
+  +files/bluetooth-init.d, +files/init.d-hidd, metadata.xml:
+  Version bump with updated init.d scripts to make them POSIX compliant
+  (following Michał Górny suggestions in bug #283057), two new USE flags
+  for compiling plugins and some upstream bugfixes that allow us to drop old
+  alsa location patch. Remove old.
+