Bug 195341

Summary: /etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution
Product: [Fedora] Fedora Reporter: Steven Augart <saugart>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: mitr, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.36-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-21 18:28:45 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:
Attachments:
Description Flags
Patch to /etc/init.d/functions
none
The actual mazu-buildmonitor startup script, as installed as /etc/init.d/mazu-buildmonitor . none

Description Steven Augart 2006-06-14 20:51:10 UTC
Description of problem:

I was writing an initscript for the mazu-buildmonitor service, and its start()
function included the line:
	daemon --pidfile=${pidfile} $PROG
This caused a complaint when I ran "service start mazu-buildmonitor:
   /etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution

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

8.31.1-1

How reproducible:
   Try to use "daemon --pidfile=" out of /etc/init.d/functions.

Steps to Reproduce:
1. Start a root shell:
   ~ # sh
2. Run the following commands:
   sh-3.1# . /etc/init.d/functions
   sh-3.1# PROG=/bin/true
   sh-3.1# pidfile=/tmp/true.pid
   sh-3.1# daemon --pidfile=${pidfile} $PROG
Actual results:
Saw the error: 
   sh: ${$1#--pidfile=}: bad substitution
And the function returned with status 1
  
Expected results:
   The output:
                                                           [  OK  ]
and the function returning with status 0.

Additional info:
   I have a fix for this.  See the attached patch.  It's a single-character   
   patch.

Comment 1 Steven Augart 2006-06-14 20:51:10 UTC
Created attachment 130924 [details]
Patch to /etc/init.d/functions

Comment 2 Steven Augart 2006-06-14 20:55:55 UTC
Created attachment 130925 [details]
The actual mazu-buildmonitor startup script, as installed as /etc/init.d/mazu-buildmonitor  .

This is here if you want to see the bug in its natural, wild state :).

Comment 3 Miloslav Trmač 2006-06-17 13:49:30 UTC
Thanks for the patch!

You can use (daemon --pidfile file ...) as a workaround.

Comment 4 Bill Nottingham 2006-07-21 18:28:45 UTC
Fixed in 8.36-1.