Bug 5080 - /sbin/service incorrectly intercepts command line arguments passed to service
Summary: /sbin/service incorrectly intercepts command line arguments passed to service
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: service (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-27 03:22 MSD by evseev
Modified: 2007-04-21 16:22 MSD (History)
4 users (show)

See Also:


Attachments
Proposed change (1.24 KB, patch)
2005-03-09 15:46 MSK, Dmitry V. Levin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description evseev 2004-08-27 03:22:02 MSD
/sbin/service looks for command line switches even after service name. So, 
"service testd -huh" is processed like "service -huh testd", not like 
"/etc/init.d/testd -huh". My little patch fixes this.

--- service.orig	2004-01-25 20:44:48 +0300
+++ service	2004-08-27 03:06:05 +0400
@@ -50,7 +50,9 @@
 			exit 0
 			;;
 		-*)
-			usage 1
+			test -z "$SERVICE" && usage 1
+			OPTIONS="$OPTIONS $1"
+			shift
 			;;
 		*)
 			if [ $# -eq 2 -a "$2" = "--full-restart" ]; then

Steps to Reproduce:
/sbin/service anything -anything

Actual Results:  
/sbin/service displays usage and fails.

Expected Results:  
Tail of command line should be passed directly to called service.
Comment 1 Dmitry V. Levin 2004-09-01 19:38:14 MSD
First, startup scripts usually have no option parser, so your script is probably
first one.

Second, your patch doesn't make possible to pass .e.g --help option to startup
script.
Comment 2 Dmitry V. Levin 2005-03-09 15:46:17 MSK
Created attachment 767 [details]
Proposed change

I'm going to apply this change to /sbin/service.
Objections?
Comment 3 Dmitry V. Levin 2005-03-09 16:07:20 MSK
Applied in 0.5.7-alt1