Author: kelmo-guest
Date: Fri Jul 18 17:30:47 2008
New Revision: 785

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=785
Log:
  Additionally, warn and override when links exist defaults are empty.
* Add test_removing_start() and test_removing_stop() to run-testsuite,
  showing that insserv will preserve existing links when script header is
  unproperly replaced with empty Default-Start or Default-Stop.
* Make test_adding_start() case a more realistic example.

Modified:
    branches/insserv-1.11.9/debian/changelog
    
branches/insserv-1.11.9/debian/patches/81_empty_stop_start_defaults_no_override.patch
    branches/insserv-1.11.9/debian/run-testsuite

Modified: branches/insserv-1.11.9/debian/changelog
URL: 
http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.9/debian/changelog?rev=785&op=diff
==============================================================================
--- branches/insserv-1.11.9/debian/changelog (original)
+++ branches/insserv-1.11.9/debian/changelog Fri Jul 18 17:30:47 2008
@@ -36,6 +36,7 @@
     thereafter, completely wrecking the test suite.
   * Add 81_empty_stop_start_defaults_no_override.patch to avoid treating
     script with empty Default-{Start,Stop} LSB keywords as non-LSB scripts.
+    Additionally, warn and override when links exist defaults are empty.
   * Refresh 31_debian_conf.patch.
   * Add an extra call to list_rclinks() in test_newbug_keepoldorder()
     function of run-testsuite, after introducing the bug.
@@ -47,8 +48,12 @@
   * Make test_bogus_facility() run-testsuite function non-fatal.
   * Mark tests that are currently failing with a comment in run-
     testsuite.
-
- -- Kel Modderman <[EMAIL PROTECTED]>  Tue, 15 Jul 2008 13:14:51 +1000
+  * Add test_removing_start() and test_removing_stop() to run-testsuite,
+    showing that insserv will preserve existing links when script header is
+    unproperly replaced with empty Default-Start or Default-Stop.
+  * Make test_adding_start() case a more realistic example.
+
+ -- Kel Modderman <[EMAIL PROTECTED]>  Sat, 19 Jul 2008 03:29:09 +1000
 
 insserv (1.11.0-9) unstable; urgency=low
 

Modified: 
branches/insserv-1.11.9/debian/patches/81_empty_stop_start_defaults_no_override.patch
URL: 
http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.9/debian/patches/81_empty_stop_start_defaults_no_override.patch?rev=785&op=diff
==============================================================================
--- 
branches/insserv-1.11.9/debian/patches/81_empty_stop_start_defaults_no_override.patch
 (original)
+++ 
branches/insserv-1.11.9/debian/patches/81_empty_stop_start_defaults_no_override.patch
 Fri Jul 18 17:30:47 2008
@@ -1,23 +1,67 @@
 When Default-Start or Default-Stop value is empty, do not treat script
 as if it does not have LSB information.
+
+Additionally, if Default-Start or Default-Stop value is empty and links
+exist for service, print a warning and override the defaults.
+
+Need to resend to upstream, this patch was previously sent but has since been
+improved.
 ---
 --- a/insserv.c
 +++ b/insserv.c
-@@ -2789,7 +2789,7 @@
+@@ -2788,7 +2788,7 @@
+                            * needed for enabling interactive services at 
first time.
                             */
                            service->start->lvl = deflvls;
- 
--                  } else {
-+                  } else if (script_inf.default_start != empty) {
+-
++#ifdef SUSE
+                   } else {
                        /*
                         * Could be a none LSB script, use info from current 
link scheme.
-                        * If not found use default.
-@@ -2834,7 +2834,7 @@
+@@ -2796,9 +2796,17 @@
+                        */
+                       if (service->attr.flags & SERV_ENABLED)
+                           script_inf.default_start = 
lvl2str(service->start->lvl);
+-#ifdef SUSE
+                       else
+                           script_inf.default_start = 
xstrdup(DEFAULT_START_LVL);
++#else
++                  } else if (script_inf.default_start && 
script_inf.default_start == empty) {
++                      if ((service->attr.flags & SERV_ENABLED) && 
service->start->lvl) {
++                          if (!defaults && !del && chkfor(d->d_name, argv, 
argc) && !(argr[curr_argc])) {
++                              warn("Warning, current start runlevel(s) (%s) 
of script `%s' overwrites defaults (%s).\n",
++                                   lvl2str(service->start->lvl), d->d_name, 
"empty");
++                              script_inf.default_start = 
lvl2str(service->start->lvl);
++                          }
++                      }
+ #endif
+                   }
+ #ifdef SUSE
+@@ -2833,7 +2841,7 @@
+                            * needed for enabling interactive services at 
first time.
                             */
                            service->stopp->lvl = deflvlk;
- 
--                  } else {
-+                  } else if (script_inf.default_stop != empty) {
+-
++#ifdef SUSE
+                   } else {
                        /*
                         * Could be a none LSB script, use info from current 
link scheme.
-                        * If not found use default.
+@@ -2841,9 +2849,17 @@
+                        */
+                       if (service->attr.flags & SERV_ENABLED)
+                           script_inf.default_stop = 
lvl2str(service->stopp->lvl);
+-#ifdef SUSE
+                       else
+                           script_inf.default_stop = xstrdup(DEFAULT_STOP_LVL);
++#else
++                  } else if (script_inf.default_stop && 
script_inf.default_stop == empty) {
++                      if ((service->attr.flags & SERV_ENABLED) && 
service->stopp->lvl) {
++                          if (!defaults && !del && chkfor(d->d_name, argv, 
argc) && !(argr[curr_argc])) {
++                              warn("Warning, current stop runlevel(s) (%s) of 
script `%s' overwrites defaults (%s).\n",
++                                   lvl2str(service->stopp->lvl), d->d_name, 
"empty");
++                              script_inf.default_stop = 
lvl2str(service->stopp->lvl);
++                          }
++                      }
+ #endif
+                   }
+               }

Modified: branches/insserv-1.11.9/debian/run-testsuite
URL: 
http://svn.debian.org/wsvn/initscripts-ng/branches/insserv-1.11.9/debian/run-testsuite?rev=785&op=diff
==============================================================================
--- branches/insserv-1.11.9/debian/run-testsuite (original)
+++ branches/insserv-1.11.9/debian/run-testsuite Fri Jul 18 17:30:47 2008
@@ -978,14 +978,14 @@
 # Required-Start:
 # Required-Stop:
 # Default-Start:
-# Default-Stop:      0
-### END INIT INFO
-EOF
-
-check_script_present 0 addstartscript
+# Default-Stop:      1
+### END INIT INFO
+EOF
+
+check_script_present 1 addstartscript
 
 check_script_not_present S addstartscript
-check_script_not_present 1 addstartscript
+check_script_not_present 0 addstartscript
 check_script_not_present 2 addstartscript
 check_script_not_present 3 addstartscript
 check_script_not_present 4 addstartscript
@@ -999,8 +999,8 @@
 # Provides:          addstartscript
 # Required-Start:
 # Required-Stop:
-# Default-Start:     1
-# Default-Stop:      0
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
 ### END INIT INFO
 EOF
 set -C
@@ -1010,15 +1010,65 @@
 
 list_rclinks
 
-check_script_present 0 addstartscript
+check_script_present 1 addstartscript
 
 check_script_not_present S addstartscript
-check_script_not_present 1 addstartscript
+check_script_not_present 0 addstartscript
 check_script_not_present 2 addstartscript
 check_script_not_present 3 addstartscript
 check_script_not_present 4 addstartscript
 check_script_not_present 5 addstartscript
 check_script_not_present 6 addstartscript
+}
+##########################################################################
+test_removing_start() {
+echo
+echo "info: Make sure that removing start levels do not change an existing 
installation."
+echo
+
+rm -rf $initddir
+mkdir -p $initddir
+
+insertscript remstartscript <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          remstartscript
+# Required-Start:
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+### END INIT INFO
+EOF
+
+check_script_present 0 remstartscript
+check_script_present 1 remstartscript
+check_script_present 2 remstartscript
+check_script_present 3 remstartscript
+check_script_present 4 remstartscript
+check_script_present 5 remstartscript
+check_script_present 6 remstartscript
+
+# Then change runlevel in existing script
+set +C
+addscript remstartscript <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          remstartscript
+# Required-Start:
+# Required-Stop:
+# Default-Start:
+# Default-Stop:      0 1 6
+### END INIT INFO
+EOF
+set -C
+
+# Update script after changing the header
+insserv_reg remstartscript || true
+
+list_rclinks
+
+check_script_present 2 remstartscript
+check_script_present 3 remstartscript
+check_script_present 4 remstartscript
+check_script_present 5 remstartscript
 }
 ##########################################################################
 test_adding_stop() {
@@ -1074,6 +1124,56 @@
 check_script_not_present 4 addstopscript
 check_script_not_present 5 addstopscript
 check_script_not_present 6 addstopscript
+}
+##########################################################################
+test_removing_stop() {
+echo
+echo "info: Make sure that removing stop levels do not change an existing 
installation."
+echo
+
+rm -rf $initddir
+mkdir -p $initddir
+
+insertscript remstopscript <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          remstopscript
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:      0 6
+### END INIT INFO
+EOF
+
+check_script_present S remstopscript
+check_script_present 0 remstopscript
+check_script_present 6 remstopscript
+
+check_script_not_present 1 remstopscript
+check_script_not_present 2 remstopscript
+check_script_not_present 3 remstopscript
+check_script_not_present 4 remstopscript
+check_script_not_present 5 remstopscript
+
+# Then change runlevel in existing script
+set +C
+addscript remstopscript <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          remstopscript
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+set -C
+
+# Update script after changing the header
+insserv_reg remstopscript || true
+
+list_rclinks
+
+check_script_present 0 remstopscript
+check_script_present 6 remstopscript
 }
 ##########################################################################
 test_duplicate_provides() {
@@ -1337,7 +1437,9 @@
 test_start_before
 test_stop_after
 test_adding_start
+test_removing_start
 test_adding_stop
+test_removing_stop
 test_duplicate_provides
 test_bogus_facility            # 1 non-fatal test failing
 test_insserv_conf_d


_______________________________________________
Initscripts-ng-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-commits

Reply via email to