Bug 158183 - /lib/lsb/init-functions alias functions don't work
/lib/lsb/init-functions alias functions don't work
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: lsb (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Elena Zannoni
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2005-05-19 10:09:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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.

#!/bin/bash
. /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:
#!/bin/sh

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

log_success_msg()
{
   /etc/redhat-lsb/lsb_log_message success "$*"
}

log_failure_msg()
{
   /etc/redhat-lsb/lsb_log_message failure  "$*"
}

log_warning_msg()
{
   /etc/redhat-lsb/lsb_log_message warning  "$*"
}

#!/bin/bash
#. /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.