Bug 195341 - /etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution
Summary: /etc/init.d/functions: line 144: ${$1#--pidfile=}: bad substitution
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-06-14 20:51 UTC by Steven Augart
Modified: 2014-03-17 03:00 UTC (History)
2 users (show)

Fixed In Version: 8.36-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-07-21 18:28:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to /etc/init.d/functions (291 bytes, patch)
2006-06-14 20:51 UTC, 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 20:55 UTC, Steven Augart
no flags Details

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.


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