Bug 158183 - /lib/lsb/init-functions alias functions don't work
/lib/lsb/init-functions alias functions don't work
Product: Fedora
Classification: Fedora
Component: lsb (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Elena Zannoni
Depends On:
  Show dependency treegraph
Reported: 2005-05-19 09:40 EDT by Matt Domsch
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-19 10:09:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Matt Domsch 2005-05-19 09:40:14 EDT
Description of problem:
 Same on RHEL3, RHEL4, FC3.  I'll open separate issues.

. /lib/lsb/init-functions
log_success_msg "hi matt"
log_failure_msg "hi matt"
log_warning_msg "hi matt"

causes this output:
$ ./lsbinitfunctions
./lsbinitfunctions: line 7: log_success_msg: command not found
./lsbinitfunctions: line 8: log_failure_msg: command not found
./lsbinitfunctions: line 9: log_warning_msg: command not found

If I change the alias lines in init-functions to full functions, it succeeds:

# LSB initscript functions, as defined in the LSB Spec 1.1.0

   /etc/redhat-lsb/lsb_log_message success "$*"

   /etc/redhat-lsb/lsb_log_message failure  "$*"

   /etc/redhat-lsb/lsb_log_message warning  "$*"

#. /lib/lsb/init-functions
. init-functions
log_success_msg "hi matt"
log_failure_msg "hi matt"
log_warning_msg "hi matt"

has the expected result:
$ ./lsbinitfunctions
hi matt                                                [  OK  ]
hi matt                                                [FAILED]
hi matt                                                [WARNING]

The result is that including /lib/lsb/init-functions doesn't work.  All the
alias lines need to be turned into full functions, if the LSB-compliant
initscripts are to work.
Comment 1 Matt Domsch 2005-05-19 09:47:27 EDT
FC4-test3 CVS as of now still has this problem, so bumping the report up to that
so it has a chance of being fixed for FC4.
Comment 2 Tim Waugh 2005-05-19 10:00:03 EDT
Shouldn't LSB-compliant initscripts start with "#!/bin/sh"?
Comment 3 Matt Domsch 2005-05-19 10:09:09 EDT
two workarounds:
If called as #!/bin/sh, aliases are expanded.
If shopt -s expand_aliases   and #!/bin/bash are used, then it'll expand the
aliases also.

I'll close this then.

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