Bug 6606 - (int-150153) No getopts, called by init-functions (lsb-base)
(int-150153)
: No getopts, called by init-functions (lsb-base)
Status: RESOLVED FIXED
Product: Core
Busybox
: 5.0/(1.2009.42-11)
: All Maemo
: Low major with 4 votes (vote)
: Harmattan
Assigned To: Turo Janka
: busybox-bugs
:
:
:
:
  Show dependency tree
 
Reported: 2009-12-05 21:32 UTC by Jeff Moe
Modified: 2011-05-22 07:53 UTC (History)
6 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Jeff Moe (reporter) 2009-12-05 21:32:55 UTC
SOFTWARE VERSION:
5.0/(1.2009.42-11)

lsb-core 3.2-15osso2

EXACT STEPS LEADING TO PROBLEM: 
1. Uh, build asterisk 1.6, install it, and...
2. /etc/init.d/asterisk start

EXPECTED OUTCOME:
Asterisk should start.

ACTUAL OUTCOME:
/etc/init.d/asterisk: line 212: getopts: not found
/etc/init.d/asterisk: line 212: getopts: not found
Starting Asterisk PBX: /etc/init.d/asterisk: line 212: getopts: not found
/etc/init.d/asterisk: line 212: getopts: not found


REPRODUCIBILITY:
100%

EXTRA SOFTWARE INSTALLED:
asterisk.... lsb-base

OTHER COMMENTS:
Ok, asterisk obviously isn't part of Core. I'm opening up this here because on
"most" systems getopts is provided by bash, but maemo uses busybox instead.

Busybox has a `getopt` command, but not getopts. I'm not sure how much
difference there is between the two.

Asterisk isn't running getopts itself, it is just doing:
 . /lib/lsb/init-functions

init-functions is a part of the lsb-core package. init-functions is trying to
call getopts, and that is where the fail comes in:

 while getopts fn:p: opt ; do


HOWTO fix? Perhaps one of the following:

1) Fix lsb-core by changing init-functions to use getopt instead of getopts

2) Have lsb-core depend on bash...

thx :)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5)
Gecko/20091105 Fedora/3.5.5-1.fc12 Firefox/3.5.5
Comment 1 Jeff Moe (reporter) 2009-12-05 22:06:29 UTC
It looks like getopts can also be enabled in the busybox build:

CONFIG_ASH_GETOPTS:

Enable getopts builtin in the ash shell.

Builtin getopt to parse positional parameters


Note, this is in addition to `getopt` (no "s") which is already built-in to
busybox.
Comment 2 Jeff Moe (reporter) 2009-12-05 22:19:19 UTC
Ah, I meant lsb-base not lsb-core above. Sry for noise.
Comment 3 Lucas Maneos 2009-12-08 20:32:09 UTC
Confirmed, and this is a requirement according to
<http://refspecs.freestandards.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/command.html>.
Comment 4 Andre Klapper maemo.org 2010-11-22 15:17:26 UTC
Harmattan (the version after Maemo5) will provide BusyBox 1.18 which includes
getopts:
~ $ getopts
/bin/sh: getopts: usage: getopts optstring var [arg]

Closing as FIXED in Harmattan.
Comment 5 Andre Klapper maemo.org 2011-05-22 07:53:46 UTC
*** Bug 12238 has been marked as a duplicate of this bug. ***