Bug 195341 - /etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution
/etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-06-14 16:51 EDT by Steven Augart
Modified: 2014-03-16 23:00 EDT (History)
2 users (show)

See Also:
Fixed In Version: 8.36-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-21 14:28:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to /etc/init.d/functions (291 bytes, patch)
2006-06-14 16:51 EDT, Steven Augart
no flags Details | Diff
The actual mazu-buildmonitor startup script, as installed as /etc/init.d/mazu-buildmonitor . (1.81 KB, text/plain)
2006-06-14 16:55 EDT, Steven Augart
no flags Details

  None (edit)
Description Steven Augart 2006-06-14 16:51:10 EDT
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 16:51:10 EDT
Created attachment 130924 [details]
Patch to /etc/init.d/functions
Comment 2 Steven Augart 2006-06-14 16:55:55 EDT
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 09:49:30 EDT
Thanks for the patch!

You can use (daemon --pidfile file ...) as a workaround.
Comment 4 Bill Nottingham 2006-07-21 14:28:45 EDT
Fixed in 8.36-1.

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