update-rc.d enable/disable actions doesn't work correctly with only 1 argument given
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sysvinit (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When giving only one argument to the update-rc.d enable/disable actions, it discards the argument altogether because of a fault in a conditional inside the update-rc.d script.
The command: "update-rc.d <service> enable 3" results in the default from /etc/init.
The fault is at row 224 in update-rc.d, where it uses "if ($#argv > 1)" to check if there are any arguments to the actions. This evaluates to false if there's only 1 argument to the enable/disable actions (argv containing (enable, 3) in my case) because of [1].
Changing this if-conditional to "if ($#argv > 0)" or equivalent would correct this issue and allow the enable/disable actions of update-rc.d to accept only one argument.
Version of sysv-rc: 2.88dsf-
Ubuntu-release: 11.10
[1]: "$#array" only reports the index of the last element of the array (indexing beginning at 0) instead of the number of elements in the array. "$#array+1" would be the number of elements.