[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#218530: Suboptimal conditional rune for initscripts



Ian Jackson wrote:

Package: debian-policy
Version: 3.6.1.0

While trying to merge an NMU to my package, I spotted an idiom
obviously copied from the policy manual:

       if [ -x /usr/sbin/invoke-rc.d ] ; then
		invoke-rc.d package <action>
       else
		/etc/init.d/package <action>
	fi

This would be better expressed as

	if type -p invoke-rc.d >/dev/null 2>&1; then
	...
I think it's debatable whether searching the path for a command in an init script is a good thing, but if we don't search the path for the test we shouldn't do it when we actually execute the command, so the code you quote is wrong either way.





Reply to: