Author: kelmo-guest
Date: Thu May 15 07:53:35 2008
New Revision: 736

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=736
Log:
* Add patch 60_disable_cfgfilter_stat to remove stat check from the
  callback function that filters the scanning of /etc/insserv.conf.d/ dir
  for confiuration file snippets. Instead do stat check in scan_conf().
* New test case to show that two initscripts cannot have the same Provides
  field.
* New test case exposing ability to insert a script into runlevel
  configuration that depends on virtual facility that is not provided or
  does not exist.
* New test case to check that /etc/insserv.conf.d/ can be used to allow one
  or more services to define and provide a virtual facility.

Added:
    trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch   (with 
props)
Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/patches/00list
    trunk/src/insserv/debian/run-testsuite

Modified: trunk/src/insserv/debian/changelog
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=736&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Thu May 15 07:53:35 2008
@@ -1,5 +1,6 @@
 insserv (1.11.0-9) UNRELEASED; urgency=low
 
+  [ Petter Reinholdtsen ]
   * New test case to demonstrate the bug reported in #477415.
   * Include empty directories /etc/insserv.conf.d and
     /etc/insserv/overrides in the package, to get dpkg to warn about
@@ -7,7 +8,19 @@
   * Debconf translations:
     - Updated German from Erik Schanze (Closes: #479254).
 
- -- Petter Reinholdtsen <[EMAIL PROTECTED]>  Sun,  4 May 2008 14:43:59 +0200
+  [ Kel Modderman ]
+  * Add patch 60_disable_cfgfilter_stat to remove stat check from the
+    callback function that filters the scanning of /etc/insserv.conf.d/ dir
+    for confiuration file snippets. Instead do stat check in scan_conf().
+  * New test case to show that two initscripts cannot have the same Provides
+    field.
+  * New test case exposing ability to insert a script into runlevel
+    configuration that depends on virtual facility that is not provided or
+    does not exist.
+  * New test case to check that /etc/insserv.conf.d/ can be used to allow one
+    or more services to define and provide a virtual facility.
+
+ -- Kel Modderman <[EMAIL PROTECTED]>  Thu, 15 May 2008 09:29:12 +1000
 
 insserv (1.11.0-8) unstable; urgency=low
 

Modified: trunk/src/insserv/debian/patches/00list
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/00list?rev=736&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/00list (original)
+++ trunk/src/insserv/debian/patches/00list Thu May 15 07:53:35 2008
@@ -9,3 +9,4 @@
 50_sign_warning
 51_overwrite_output
 52_shutdown_links
+60_disable_cfgfilter_stat

Added: trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch?rev=736&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch (added)
+++ trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch Thu May 
15 07:53:35 2008
@@ -1,0 +1,42 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 60_disable_cfgfilter_stat.dpatch by Kel Modderman <[EMAIL PROTECTED]>
+##
+## DP: The call to stat in scandir filter is flawed, it does not stat
+## DP: full path to file and prevents /etc/insserv.conf.d/* from being
+## DP: used. The filter function is called at one other location, and a
+## DP: stat + IS_REG() test is done before that.
+
[EMAIL PROTECTED]@
+diff -urNad insserv~/insserv.c insserv/insserv.c
+--- insserv~/insserv.c 2008-05-15 01:11:53.000000000 +1000
++++ insserv/insserv.c  2008-05-15 01:13:36.000000000 +1000
+@@ -1810,11 +1810,6 @@
+       return 0;
+     if ((*name == '.') && ((*(name+1) == '\0') || (*(name+1) == '.')))
+       return 0;
+-    else {
+-      struct stat st;
+-      if ((stat(name,&st) < 0) || !S_ISREG(st.st_mode))
+-          return 0;
+-    }
+     if ((end = strrchr(name, '.'))) {
+       end++;
+       if (!strncmp(end, "rpm", 3)     || /* .rpmorig, .rpmnew, .rmpsave, ... 
*/
+@@ -1868,6 +1863,7 @@
+     n = scandir(path, &namelist, cfgfile_filter, alphasort);
+     if(n > 0) {
+       while(n--) {
++          struct stat st;
+           char buf[PATH_MAX+1];
+           int r;
+ 
+@@ -1875,6 +1871,9 @@
+           if (r >= (int)sizeof(buf) || r < 0)
+               error("snprintf(): %s\n", strerror(errno));
+ 
++          if ((stat(buf, &st) < 0) || !S_ISREG(st.st_mode))
++              continue;
++
+           scan_conf_file(buf);
+ 
+           free(namelist[n]);

Propchange: trunk/src/insserv/debian/patches/60_disable_cfgfilter_stat.dpatch
------------------------------------------------------------------------------
    svn:executable = *

Modified: trunk/src/insserv/debian/run-testsuite
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=736&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Thu May 15 07:53:35 2008
@@ -985,6 +985,129 @@
 check_script_not_present 4 testscript
 check_script_not_present 5 testscript
 check_script_not_present 6 testscript
+}
+##########################################################################
+test_duplicate_provides() {
+echo
+echo "info: test two initscripts providing same facility"
+echo
+rm -rf $initddir
+mkdir -p $initddir
+
+insertscript one <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          samefac
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+addscript two <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          samefac
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+insserv_reg two || true
+
+list_rclinks
+
+check_script_not_present S two
+}
+##########################################################################
+test_bogus_facility() {
+echo
+echo "info: test insertion of script requiring a virtual facility that doesn't 
exist"
+echo
+rm -rf $initddir ${insconf}.d
+mkdir -p $initddir ${insconf}.d
+
+addscript dummy <<'EOF'
+### BEGIN INIT INFO
+# Provides:          dummy
+# Required-Start:    $bogusvirtualfacility
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+insserv_reg dummy || true
+
+list_rclinks
+
+${severity}_script_not_present S dummy
+}
+##########################################################################
+test_insserv_conf_d() {
+echo
+echo "info: test that /etc/insserv.conf.d/ is used"
+echo
+rm -rf $initddir ${insconf}.d
+mkdir -p $initddir ${insconf}.d
+
+# add a base service, to ensure check_order() is accurate
+insertscript dummy <<'EOF'
+### BEGIN INIT INFO
+# Provides:          dummy
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+cat <<'EOF' > ${insconf}.d/facone
+$commvirtfac       +facone
+EOF
+
+insertscript facone <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          facone
+# Required-Start:    dummy
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+cat <<'EOF' > ${insconf}.d/factwo
+$commvirtfac       +factwo
+EOF
+
+insertscript factwo <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          factwo
+# Required-Start:    dummy
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+addscript service <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          service
+# Required-Start:    $commvirtfac
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+insserv_reg service || true
+
+list_rclinks
+
+check_script_present S service
+check_order S facone service
+check_order S factwo service
 }
 ##########################################################################
 
@@ -1005,3 +1128,6 @@
 test_start_before
 test_stop_after
 test_adding_stop
+test_duplicate_provides
+test_bogus_facility
+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