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

Bug#46810: dpkg: update-rc.d should check for numbers being <100



Package: dpkg
Version: 1.4.1.13

update-rc.d does not check that the numbers it is given are at most
two digits.  The following patch fixes this:

--- update-rc.d.orig	Wed Oct  6 15:54:12 1999
+++ update-rc.d	Wed Oct  6 16:13:13 1999
@@ -96,7 +96,7 @@
 	}
 	opendir(DIR, ".");
 	foreach $_ (readdir(DIR)) {
-	    next unless (/^[S|K][0-9]*$bn$/);
+	    next unless (/^[S|K]\d\d$bn$/);
 	    $fn = "$etcd$i.d/$_";
 	    $found = 1;
 	    $islnk = &is_link ($_[0], $fn, $bn);
@@ -123,8 +123,8 @@
     &usage ("defaults takes only one or two codenumbers") if ($#ARGV > 2);
     $start = $stop = $ARGV[1] if ($#ARGV >= 1);
     $stop  =         $ARGV[2] if ($#ARGV >= 2);
-    &usage ("codenumber must be a number")
-	if ($start !~ /^[0-9]+$/ || $stop  !~ /^[0-9]+$/);
+    &usage ("codenumber must be a number between 0 and 99")
+	if ($start !~ /^\d\d?$/ || $stop  !~ /^\d\d?$/);
 
     $start = sprintf("%02d", $start);
     $stop  = sprintf("%02d", $stop);
@@ -149,7 +149,7 @@
 	    &usage("expected start|stop");
 	}
 
-	if ($ARGV[1] !~ /^[0-9]+$/) {
+	if ($ARGV[1] !~ /^\d\d?$/) {
 	    &usage("expected NN after $ARGV[0]");
 	}
 	$NN = sprintf("%02d", $ARGV[1]);


   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  Julian Gilbey, Dept of Maths, QMW, Univ. of London. J.D.Gilbey@qmw.ac.uk
        Debian GNU/Linux Developer,  see http://www.debian.org/~jdg


Reply to: