Bug 217566 - /lib/lsb/init-functions erroneously uses 'alias' to define lsb compatible init functions
/lib/lsb/init-functions erroneously uses 'alias' to define lsb compatible ini...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: redhat-lsb (Show other bugs)
5.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Lawrence Lim
David Lawrence
: Reopened
: 218989 230973 (view as bug list)
Depends On:
Blocks: 217570 218245
  Show dependency treegraph
 
Reported: 2006-11-28 12:33 EST by Bryn M. Reeves
Modified: 2014-03-25 20:54 EDT (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2007-0590
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-07 13:01:42 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
convert aliases to functions in /lib/lsb/init-functions (935 bytes, patch)
2006-11-28 12:37 EST, Bryn M. Reeves
no flags Details | Diff
convert aliases to functions in /lib/lsb/init-functions (966 bytes, patch)
2006-12-05 06:01 EST, Bryn M. Reeves
no flags Details | Diff
lsb-aliases_to_funcs.patch (966 bytes, patch)
2007-04-02 11:10 EDT, Jose Plans
no flags Details | Diff

  None (edit)
Description Bryn M. Reeves 2006-11-28 12:33:45 EST
+++ 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 12:37:10 EST
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 Product and Program Management 2006-11-28 13:00:45 EST
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-28 20:42:40 EST
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 09:50:20 EST
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-03 23:13:30 EST
Fix in redhat-lsb-3.1-12.
Comment 7 Jakub Jelinek 2006-12-04 08:27:10 EST
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 06:01:16 EST
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 03:39:58 EST
Patch revised in redhat-lsb-3.1-12.2.EL. Thanks.
Comment 10 Lawrence Lim 2006-12-10 05:06:24 EST
*** Bug 218989 has been marked as a duplicate of this bug. ***
Comment 11 Jan Glauber 2007-01-12 11:11:00 EST
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 Product and Program Management 2007-02-07 19:59:09 EST
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 11:10:01 EDT
Created attachment 151434 [details]
lsb-aliases_to_funcs.patch
Comment 16 Lawrence Lim 2007-04-03 20:42:43 EDT
5.1 should be better. I will try to propose.
Comment 18 Irina Boverman 2007-05-17 15:29:59 EDT
Did we integrate this patch? 
Comment 19 Lawrence Lim 2007-05-18 11:01:00 EDT
Not in 5.0 but it will be available in the 5.1 update.
Comment 20 Lawrence Lim 2007-06-17 21:48:45 EDT
*** Bug 230973 has been marked as a duplicate of this bug. ***
Comment 25 errata-xmlrpc 2007-11-07 13:01:42 EST
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

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