Bug 217566

Summary: /lib/lsb/init-functions erroneously uses 'alias' to define lsb compatible init functions
Product: Red Hat Enterprise Linux 5 Reporter: Bryn M. Reeves <bmr>
Component: redhat-lsbAssignee: Lawrence Lim <llim>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: iboverma, mbest, pcormier, tools-bugs
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0590 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-07 18:01:42 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:
Bug Depends On:    
Bug Blocks: 217570, 218245    
Attachments:
Description Flags
convert aliases to functions in /lib/lsb/init-functions
none
convert aliases to functions in /lib/lsb/init-functions
none
lsb-aliases_to_funcs.patch none

Description Bryn M. Reeves 2006-11-28 17:33:45 UTC
+++ This bug was initially created as a clone of Bug #171052 +++

Description of problem:

The /lib/lsb/init-functions file (both on Fedora Core and RHEL4 / RHEL5 Beta)
uses alias to attempt to set up lsb init script support functions such as
log_success_msg and log_failure_msg.

Unfortunately, /lib/lsb/init-functions wrongly uses alias for this purpose,
despite the fact that neither Bash
(http://www.gnu.org/software/bash/manual/bashref.html#SEC79) nor the Posix
standard (see
http://www.opengroup.org/onlinepubs/009695399/utilities/alias.html) shell by
default will expand aliases during non-interactive shell script processing.

The /lib/lsb/init-functions file needs to be rewritten to define the commands as
true shell functions, and not aliases.

Version-Release number of selected component (if applicable):

redhat-lsb-3.1-11

How reproducible:
100%

Steps to Reproduce:
1. Install Xen for RHEL5 (or any package using lsb init functions)
2. run /etc/init.d/xendomains status (or any init script using lsb init functions)
  
Actual results:
# /etc/init.d/xendomains status
Checking for xendomains:/etc/init.d/xendomains: line 69: log_failure_msg:
command not found

Expected results:
correct invocation of the /etc/init.d/functions success function by xendomains
script. 

Output should be:

# /etc/init.d/xendomains status
Checking for xendomains:                                   [FAILED]

with no domains configured/running, or:

# /etc/init.d/xendomains status
Checking for xendomains: v1                                [  OK  ]

If there are some xen auto domains configured & running.


Additional info:
The Fedora bug this was cloned from has been sitting in NEW for over a year (bug
was filed against lsb rather than redhat-lsb).

Comment 1 Bryn M. Reeves 2006-11-28 17:37:10 UTC
Created attachment 142310 [details]
convert aliases to functions in /lib/lsb/init-functions

A simple patch is attached that replaces the alias definitions with true
functions. This was tested with /etc/init.d/xendomains and works - this seems
to be the only initscript in RHEL that uses the lsb definitions so this should
be a fairly low-risk change.

Comment 2 RHEL Program Management 2006-11-28 18:00:45 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Lawrence Lim 2006-11-29 01:42:40 UTC
Thanks for the bug report. 

Patch has been applied and built into redhat-lsb-3.1-12.src.rpm under RHEL5-branch.

Comment 5 Bryn M. Reeves 2006-11-29 14:50:20 UTC
Thanks - tested with redhat-lsb-3.1-12.1.i386.rpm and now works fine with the
stock xendomains script.


Comment 6 Lawrence Lim 2006-12-04 04:13:30 UTC
Fix in redhat-lsb-3.1-12.

Comment 7 Jakub Jelinek 2006-12-04 13:27:10 UTC
Shouldn't those shell functions pass arguments down to what they are executing?
I.e. have "$@" at the end?

Comment 8 Bryn M. Reeves 2006-12-05 11:01:16 UTC
Created attachment 142821 [details]
convert aliases to functions in /lib/lsb/init-functions

Yes, they should: revised patch attached with this correction.

Comment 9 Lawrence Lim 2006-12-06 08:39:58 UTC
Patch revised in redhat-lsb-3.1-12.2.EL. Thanks.

Comment 10 Lawrence Lim 2006-12-10 10:06:24 UTC
*** Bug 218989 has been marked as a duplicate of this bug. ***

Comment 11 Jan Glauber 2007-01-12 16:11:00 UTC
Hi Lawrence,
we have noticed that one of the functions has a strange name:

+pidofprof () {
+	/etc/redhat-lsb/lsb_pidofproc "$@"

Shouldn't that be pidofproc instead?
Jan

Comment 12 RHEL Program Management 2007-02-08 00:59:09 UTC
A package has been built which should help the problem described in 
this bug report. This report is therefore being closed with a resolution 
of CURRENTRELEASE. You may reopen this bug report if the solution does 
not work for you.


Comment 14 Jose Plans 2007-04-02 15:10:01 UTC
Created attachment 151434 [details]
lsb-aliases_to_funcs.patch

Comment 16 Lawrence Lim 2007-04-04 00:42:43 UTC
5.1 should be better. I will try to propose.

Comment 18 Irina Boverman 2007-05-17 19:29:59 UTC
Did we integrate this patch? 

Comment 19 Lawrence Lim 2007-05-18 15:01:00 UTC
Not in 5.0 but it will be available in the 5.1 update.

Comment 20 Lawrence Lim 2007-06-18 01:48:45 UTC
*** Bug 230973 has been marked as a duplicate of this bug. ***

Comment 25 errata-xmlrpc 2007-11-07 18:01:42 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0590.html