[Pkg-sysvinit-devel] Bug#690314: /etc/init.d/rc may execute S##<name> or K##<name> scripts twice if <name> starts with upper case characters

Reichel, Philip Philip.Reichel.External at cassidian.com
Fri Oct 12 12:28:00 UTC 2012


Package: sysv-rc
Version: 2.86.ds1-61

/etc/init.d/rc may execute S##<name>  or K##<name> scripts twice
if <name> starts with upper case characters.

/etc/init.d/rc execution loop works in principle as follows:

generate alphabetically ordered list of all S* or K* files in the rc*.d
directory
set current level number to empty string
for all files in list:
	remove leading S or K from file name
	remove trailing <name> fom file name
	compare resulting ## number with current level number
	if numbers do not match
		set current level number to resulting ## number
		generate list of all files matching S##.* (or K##.*
respectively)
		execute all script file found by the name pattern
matching
	fi
rof			

However, the script seems not to properly recognize and truncate <name>
parts starting with upper case letters.
So, if one defines a start script like S99Tomcat
the script does not only extract the number part 99 but also the upper
case character(s) setting level number to 99T
Would s.o. name a script S99TOMCAT the resulting level number would be
S99TOMCAT
	
This alone does not produce an error, because the script does match the
pattern S##.* (with ## being S99TOMCAT) and will be executed.

But for the case that another script with same level number exists,
S99TOMCAT will be executed twice.
e.g: two scripts: S99TOMCAT and S99apache.
for S99apache the resulting level number is 99.
the loop then executes all scripts matching the pattern S99.*, which is
s99apache and S99TOMCAT.
for S99TOMCAT the resulting level number is 99TOMCAT, which does not
match the curren level number 99.
As a result the rc script handles 99TOMCAT like another level number and
executes all scripts matching S99TOMCAT.* - and starts therefore
S99TOMCAT for the second time.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20121012/c343bdfd/attachment.html>


More information about the Pkg-sysvinit-devel mailing list