[lintian] 03/03: Detect suspicious use of ln that could be replaced by dpkg-maintscript-helper
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit 7939aad86a8da0f7ef428decc4a8e6629b825032
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Wed Aug 5 14:24:05 2015 +0200
Detect suspicious use of ln that could be replaced by dpkg-maintscript-helper
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/scripts.desc | 11 +++++++++++
data/scripts/maintainer-script-bad-command | 1 +
debian/changelog | 4 ++++
t/scripts/implemented-tags.t | 1 +
t/tests/scripts-maintainer-general/debian/debian/postinst | 7 +++++++
t/tests/scripts-maintainer-general/desc | 1 +
t/tests/scripts-maintainer-general/tags | 1 +
7 files changed, 26 insertions(+)
diff --git a/checks/scripts.desc b/checks/scripts.desc
index 979393a..a8b4d7d 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -628,6 +628,17 @@ Info: The maintainer script apparently runs 'adduser --system'
<tt>adduser --no-create-home --home /nonexistent</tt> instead.
Ref: fhs homeuserhomedirectories, adduser(8)
+Tag: maintainer-script-may-use-dir_to_symlink_helper
+Severity: serious
+Certainty: possible
+Experimental: yes
+Info: The maintainer script apparently change a directory to a symlink
+ not using dir_to_symlink command of dpkg-maintscript-helper, that take
+ great care to avoid a lot of problems.
+ .
+ Please use the dpkg-maintscript-helper dir_to_symlink command.
+Ref: dpkg-maintscript-helper(1)
+
Tag: maintainer-script-empty
Severity: minor
Certainty: certain
diff --git a/data/scripts/maintainer-script-bad-command b/data/scripts/maintainer-script-bad-command
index b0794a6..bfad17a 100644
--- a/data/scripts/maintainer-script-bad-command
+++ b/data/scripts/maintainer-script-bad-command
@@ -42,6 +42,7 @@ maintainer-script-should-not-use-start-stop-daemon ~~ 0 ~~
maintainer-script-should-not-use-update-alternatives-remove ~~ 1 ~~ ~~^postrm$ ~~\b update\-alternatives\s+\-\-remove\b
maintainer-script-should-not-use-update-alternatives-set ~~ 1 ~~ ~~ ~~^(?!\s*echo\s+["'][^'"]*)\bupdate\-alternatives\s+\-\-(?:set|set\-selections|config)\b
trailing-slash-for-dpkg-maintscript-helper-symlink_to_dir ~~ 1 ~~ ~~ ~~ dpkg-maintscript-helper\s+symlink_to_dir\s+[^\s]+/\s
+maintainer-script-may-use-dir_to_symlink_helper ~~ 1 ~~ ~~ ~~ ln[ ]*-f?s.*doc
# sendmail use override do not change it now
suidregister-used-in-maintainer-script ~~ 1 ~~ ~~ ~~\bsuidregister\b
diff --git a/debian/changelog b/debian/changelog
index 01011f1..e6e160d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ lintian (2.5.36) UNRELEASED; urgency=medium
XXX: generate tag summary with private/generate-tag-summary
+ * checks/scripts.desc:
+ + [BR] Detect suspicious use of ln -s that could be replaced by
+ dpkg-maintscript-helper.
+
* debian/compat:
+ [BR] Use compat version 9.
diff --git a/t/scripts/implemented-tags.t b/t/scripts/implemented-tags.t
index aaed590..82316de 100755
--- a/t/scripts/implemented-tags.t
+++ b/t/scripts/implemented-tags.t
@@ -47,6 +47,7 @@ our $EXCLUDE =join(
^hardening-.*$
^privacy-breach-.*$
^maintainer-script-should-not-.*$
+ ^maintainer-script-may-.*$
^install-info-used-in-maintainer-script$
^license-problem-cc-by-nc-sa$
^license-problem-json-evil$
diff --git a/t/tests/scripts-maintainer-general/debian/debian/postinst b/t/tests/scripts-maintainer-general/debian/debian/postinst
index 39c4731..2346e0f 100755
--- a/t/tests/scripts-maintainer-general/debian/debian/postinst
+++ b/t/tests/scripts-maintainer-general/debian/debian/postinst
@@ -197,4 +197,11 @@ dpkg-maintscript-helper symlink_to_dir \
adduser --system --quiet --ingroup ntp --no-create-home ntp
adduser festival --quiet --system --ingroup audio --no-create-home
+# detect usage that could be replaced by dpkg-maintscript-helper
+if [ -d /usr/share/doc/tworld ]; then
+ if rmdir /usr/share/doc/tworld 2>/dev/null; then
+ ln -s tworld-data /usr/share/doc/tworld
+ fi
+fi
+
#DEBHELPER#
diff --git a/t/tests/scripts-maintainer-general/desc b/t/tests/scripts-maintainer-general/desc
index fab5701..2d83d1b 100644
--- a/t/tests/scripts-maintainer-general/desc
+++ b/t/tests/scripts-maintainer-general/desc
@@ -35,4 +35,5 @@ Test-For:
read-in-maintainer-script
suidregister-used-in-maintainer-script
trailing-slash-for-dpkg-maintscript-helper-symlink_to_dir
+ maintainer-script-may-use-dir_to_symlink_helper
References: Debian Bug#532984
diff --git a/t/tests/scripts-maintainer-general/tags b/t/tests/scripts-maintainer-general/tags
index 39a2f55..068aa28 100644
--- a/t/tests/scripts-maintainer-general/tags
+++ b/t/tests/scripts-maintainer-general/tags
@@ -44,4 +44,5 @@ W: scripts-maintainer-general: maintainer-script-should-not-use-start-stop-daemo
W: scripts-maintainer-general: maintainer-script-should-not-use-update-alternatives-remove postrm:7
W: scripts-maintainer-general: maintainer-script-should-not-use-update-alternatives-set postinst:129
W: scripts-maintainer-general: possibly-insecure-handling-of-tmp-files-in-maintainer-script postinst:26
+X: scripts-maintainer-general: maintainer-script-may-use-dir_to_symlink_helper postinst:203
X: scripts-maintainer-general: maintainer-script-should-not-use-service postinst:156
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: