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

[lintian] 01/01: Check for files that use content from the /etc/init.d/skeleton template. Thanks to Christoph Biedl for the idea. (Closes: #879152)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit 3e445046048959d85e0e03c7359ba20796de58ee
Author: Chris Lamb <lamby@debian.org>
Date:   Thu Oct 19 16:36:04 2017 -0400

    Check for files that use content from the /etc/init.d/skeleton template. Thanks to Christoph Biedl for the idea. (Closes: #879152)
---
 checks/init.d.desc                                               | 9 +++++++++
 checks/init.d.pm                                                 | 4 ++++
 debian/changelog                                                 | 3 +++
 .../debian/debian/init}                                          | 4 ++--
 t/tests/init.d-script-contains-skeleton-template-content/desc    | 5 +++++
 t/tests/init.d-script-contains-skeleton-template-content/tags    | 1 +
 t/tests/legacy-scripts/tags                                      | 2 +-
 t/tests/legacy-scripts/upstream/init-lsb-broken                  | 2 +-
 t/tests/legacy-scripts/upstream/init-skeleton                    | 7 +------
 t/tests/systemd-general/debian/debian/init                       | 7 +------
 t/tests/systemd-general/debian/debian/masked.init                | 7 +------
 t/tests/systemd-general/debian/debian/sourced.sh.init            | 7 +------
 t/tests/systemd-general/debian/debian/systemd-aliasd.init        | 7 +------
 t/tests/systemd-general/tags                                     | 2 +-
 14 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/checks/init.d.desc b/checks/init.d.desc
index b4080fd..ad7f65e 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -359,3 +359,12 @@ Severity: important
 Certainty: possible
 Info: The given init script sources the <tt>/lib/lsb/init-functions</tt> utility
  functions without declaring the corresponding dependency on lsb-base.
+
+Tag: init.d-script-contains-skeleton-template-content
+Severity: important
+Certainty: certain
+Info: The given init script appears to contain content from the
+ <tt>/etc/init.d/skeleton</tt> example.
+ .
+ Please double-check the script and/or replace it with content suitable to
+ this binary package.
diff --git a/checks/init.d.pm b/checks/init.d.pm
index f85a276..9b13c1d 100644
--- a/checks/init.d.pm
+++ b/checks/init.d.pm
@@ -255,6 +255,10 @@ sub check_init {
                 }
             }
         }
+        if ($l =~ m/Please remove the "Author" lines|Example initscript/) {
+            tag 'init.d-script-contains-skeleton-template-content',
+              "${initd_path}:$.";
+        }
         if ($l =~ m/^\#\#\# BEGIN INIT INFO/) {
             if ($lsb{BEGIN}) {
                 tag 'init.d-script-has-duplicate-lsb-section',$initd_path;
diff --git a/debian/changelog b/debian/changelog
index 2facee4..d478049 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,9 @@ lintian (2.5.56) UNRELEASED; urgency=medium
   * checks/fields.pm:
     + [CL] Apply patch from Nicolas Boulenguez to accept and recommend the
       new vcs-mtn mtn:// uri format.  (Closes: #878798)
+  * checks/init.d.pm:
+    + [CL] Check for files that use content from the /etc/init.d/skeleton
+      template. Thanks to Christoph Biedl for the idea.  (Closes: #879152)
   * checks/md5sums.pm:
     + [CL] Allow empty md5sums files.  (Closes: #781372)
   * checks/source-changelog.{desc.pm}:
diff --git a/t/tests/systemd-general/debian/debian/masked.init b/t/tests/init.d-script-contains-skeleton-template-content/debian/debian/init
similarity index 88%
copy from t/tests/systemd-general/debian/debian/masked.init
copy to t/tests/init.d-script-contains-skeleton-template-content/debian/debian/init
index cda4972..90c5dc7 100644
--- a/t/tests/systemd-general/debian/debian/masked.init
+++ b/t/tests/init.d-script-contains-skeleton-template-content/debian/debian/init
@@ -4,7 +4,7 @@ if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
     set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
 fi
 ### BEGIN INIT INFO
-# Provides:          masked
+# Provides:          init.d-script-contains-skeleton-template-content
 # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
@@ -13,7 +13,7 @@ fi
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.  This example start a
 #                    single forking daemon capable of writing a pid
-#                    file.  To get other behaviors, implement
+#                    file.  To get other behavoirs, implemend
 #                    do_start(), do_stop() or other functions to
 #                    override the defaults in /lib/init/init-d-script.
 ### END INIT INFO
diff --git a/t/tests/init.d-script-contains-skeleton-template-content/desc b/t/tests/init.d-script-contains-skeleton-template-content/desc
new file mode 100644
index 0000000..9f651b9
--- /dev/null
+++ b/t/tests/init.d-script-contains-skeleton-template-content/desc
@@ -0,0 +1,5 @@
+Testname: init.d-script-contains-skeleton-template-content
+Version: 1.0
+Description: Test for scripts using the /etc/init.d/skeleton template
+Test-For:
+ init.d-script-contains-skeleton-template-content
diff --git a/t/tests/init.d-script-contains-skeleton-template-content/tags b/t/tests/init.d-script-contains-skeleton-template-content/tags
new file mode 100644
index 0000000..7cadcf2
--- /dev/null
+++ b/t/tests/init.d-script-contains-skeleton-template-content/tags
@@ -0,0 +1 @@
+E: init.d-script-contains-skeleton-template-content: init.d-script-contains-skeleton-template-content etc/init.d/init.d-script-contains-skeleton-template-content:23
diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags
index 2feeb5d..1d334e6 100644
--- a/t/tests/legacy-scripts/tags
+++ b/t/tests/legacy-scripts/tags
@@ -10,7 +10,7 @@ E: scripts: init.d-script-does-not-implement-required-option etc/init.d/lsb-brok
 E: scripts: init.d-script-does-not-implement-required-option etc/init.d/lsb-broken restart
 E: scripts: init.d-script-has-duplicate-lsb-section etc/init.d/lsb-broken
 E: scripts: init.d-script-has-unterminated-lsb-section etc/init.d/lsb-broken:15
-E: scripts: init.d-script-needs-depends-on-lsb-base etc/init.d/skeleton (line 40)
+E: scripts: init.d-script-needs-depends-on-lsb-base etc/init.d/skeleton (line 35)
 E: scripts: missing-dep-for-interpreter jruby => jruby | jruby1.0 | jruby1.1 | jruby1.2 (usr/bin/jruby-broken)
 E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo)
 E: scripts: missing-dep-for-interpreter python2 => python:any | python-minimal:any (usr/bin/py2foo)
diff --git a/t/tests/legacy-scripts/upstream/init-lsb-broken b/t/tests/legacy-scripts/upstream/init-lsb-broken
index c2d3c29..e4dfa92 100644
--- a/t/tests/legacy-scripts/upstream/init-lsb-broken
+++ b/t/tests/legacy-scripts/upstream/init-lsb-broken
@@ -5,7 +5,7 @@
 # Required-Stop:     
 # Default-Start:     1 2 3 4 5
 # Default-Stop:      S 0 1 6 X
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 #                    but this can't be continued
 # Description:       An example of a bad LSB section in an init script.
 #                    This continuation is allowed (with spaces).
diff --git a/t/tests/legacy-scripts/upstream/init-skeleton b/t/tests/legacy-scripts/upstream/init-skeleton
index 55f05c0..c868508 100644
--- a/t/tests/legacy-scripts/upstream/init-skeleton
+++ b/t/tests/legacy-scripts/upstream/init-skeleton
@@ -5,16 +5,11 @@
 # Required-Stop:     $local_fs $remote_fs
 # Default-Start:     2 3 4 5
 # Default-Stop:      S 0 1 6
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.
 ### END INIT INFO
 
-# Author: Foo Bar <foobar@baz.org>
-#
-# Please remove the "Author" lines above and replace them
-# with your own name if you copy and modify this script.
-
 # Do NOT "set -e"
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
diff --git a/t/tests/systemd-general/debian/debian/init b/t/tests/systemd-general/debian/debian/init
index 42cb175..96f6ed2 100644
--- a/t/tests/systemd-general/debian/debian/init
+++ b/t/tests/systemd-general/debian/debian/init
@@ -5,16 +5,11 @@
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     S 2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.
 ### END INIT INFO
 
-# Author: Foo Bar <foobar@baz.org>
-#
-# Please remove the "Author" lines above and replace them
-# with your own name if you copy and modify this script.
-
 # Do NOT "set -e"
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
diff --git a/t/tests/systemd-general/debian/debian/masked.init b/t/tests/systemd-general/debian/debian/masked.init
index cda4972..b884a82 100644
--- a/t/tests/systemd-general/debian/debian/masked.init
+++ b/t/tests/systemd-general/debian/debian/masked.init
@@ -9,7 +9,7 @@ fi
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.  This example start a
 #                    single forking daemon capable of writing a pid
@@ -18,10 +18,5 @@ fi
 #                    override the defaults in /lib/init/init-d-script.
 ### END INIT INFO
 
-# Author: Foo Bar <foobar@baz.org>
-#
-# Please remove the "Author" lines above and replace them
-# with your own name if you copy and modify this script.
-
 DESC="Description of the service"
 DAEMON=/usr/sbin/daemonexecutablename
diff --git a/t/tests/systemd-general/debian/debian/sourced.sh.init b/t/tests/systemd-general/debian/debian/sourced.sh.init
index f6dd87d..6657c99 100644
--- a/t/tests/systemd-general/debian/debian/sourced.sh.init
+++ b/t/tests/systemd-general/debian/debian/sourced.sh.init
@@ -9,7 +9,7 @@ fi
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.  This example start a
 #                    single forking daemon capable of writing a pid
@@ -18,10 +18,5 @@ fi
 #                    override the defaults in /lib/init/init-d-script.
 ### END INIT INFO
 
-# Author: Foo Bar <foobar@baz.org>
-#
-# Please remove the "Author" lines above and replace them
-# with your own name if you copy and modify this script.
-
 DESC="Description of the service"
 DAEMON=/usr/sbin/daemonexecutablename
diff --git a/t/tests/systemd-general/debian/debian/systemd-aliasd.init b/t/tests/systemd-general/debian/debian/systemd-aliasd.init
index 775eb1a..95e791c 100644
--- a/t/tests/systemd-general/debian/debian/systemd-aliasd.init
+++ b/t/tests/systemd-general/debian/debian/systemd-aliasd.init
@@ -5,16 +5,11 @@
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Example initscript
+# Short-Description: Example Lintian initscript
 # Description:       This file should be used to construct scripts to be
 #                    placed in /etc/init.d.
 ### END INIT INFO
 
-# Author: Foo Bar <foobar@baz.org>
-#
-# Please remove the "Author" lines above and replace them
-# with your own name if you copy and modify this script.
-
 # Do NOT "set -e"
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags
index 38aa9cc..5d0feff 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -1,5 +1,5 @@
 E: systemd-general: init-script-is-not-a-file etc/init.d/fifo-pipe-as-init
-E: systemd-general: init.d-script-needs-depends-on-lsb-base etc/init.d/systemd-aliasd (line 35)
+E: systemd-general: init.d-script-needs-depends-on-lsb-base etc/init.d/systemd-aliasd (line 30)
 E: systemd-general: service-file-is-not-a-file etc/systemd/system/fifo-pipe-as-init.service
 E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service at line 4
 E: systemd-general: service-key-has-whitespace usr/lib/systemd/system/test.service at line 4

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: