Bug 158183 - /lib/lsb/init-functions alias functions don't work
Summary: /lib/lsb/init-functions alias functions don't work
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: lsb   
(Show other bugs)
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Elena Zannoni
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-05-19 13:40 UTC by Matt Domsch
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

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: ---


Attachments (Terms of Use)

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.


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