Bug 158183

Summary: /lib/lsb/init-functions alias functions don't work
Product: [Fedora] Fedora Reporter: Matt Domsch <matt_domsch>
Component: lsbAssignee: Elena Zannoni <ezannoni>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-19 14:09:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matt Domsch 2005-05-19 13:40:14 UTC
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 13:47:27 UTC
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 14:00:03 UTC
Shouldn't LSB-compliant initscripts start with "#!/bin/sh"?

Comment 3 Matt Domsch 2005-05-19 14:09:09 UTC
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.