[Bug 953604] [NEW] update-rc.d enable/disable actions doesn't work correctly with only 1 argument given
Patrick Börjesson
patrick.borjesson at gmail.com
Tue Mar 13 00:55:52 UTC 2012
Public bug reported:
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.d/<service> being used instead of enabling the service
for only runlevel 3 (as specified in the command). When giving more than
one runlevel, it works as intended.
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-12.10ubuntu4.1
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.
** Affects: sysvinit (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to sysvinit in Ubuntu.
https://bugs.launchpad.net/bugs/953604
Title:
update-rc.d enable/disable actions doesn't work correctly with only 1
argument given
Status in “sysvinit” package in Ubuntu:
New
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.d/<service> being used instead of enabling the service
for only runlevel 3 (as specified in the command). When giving more
than one runlevel, it works as intended.
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-12.10ubuntu4.1
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/953604/+subscriptions
More information about the foundations-bugs
mailing list