diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
commit | 75808db17caf8b960b351e3408e74142f4c85aac (patch) | |
tree | 7989e9c09a4240248bf4658a22208a0a52d991c4 /t/recipes/checks/maintainer-scripts | |
parent | Initial commit. (diff) | |
download | lintian-75808db17caf8b960b351e3408e74142f4c85aac.tar.xz lintian-75808db17caf8b960b351e3408e74142f4c85aac.zip |
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
275 files changed, 5518 insertions, 0 deletions
diff --git a/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/debian/postinst new file mode 100755 index 0000000..51a4df4 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/debian/postinst @@ -0,0 +1,14 @@ +#! /bin/sh +# excerpt from postinst script for pulseaudio + +case "$1" in + configure) + if ! getent passwd pulse >/dev/null; then + adduser --disabled-password --quiet --system \ + --home /var/run/pulse --no-create-home\ + --gecos "PulseAudio daemon" --group pulse + fi + ;; +esac + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/fill-values new file mode 100644 index 0000000..b2fefca --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: home-in-var-run +Description: Test for {pre,post}inst script which calls adduser --home /var/run diff --git a/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/desc b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/desc new file mode 100644 index 0000000..075b41a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/desc @@ -0,0 +1,2 @@ +Testname: home-in-var-run +Check: maintainer-scripts/adduser diff --git a/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/hints b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/hints new file mode 100644 index 0000000..ed262f1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/adduser/home-in-var-run/eval/hints @@ -0,0 +1 @@ +home-in-var-run (binary): adduser-with-home-var-run [postinst:9] diff --git a/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/changelog.in new file mode 100644 index 0000000..d25031a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/changelog.in @@ -0,0 +1,20 @@ +[% $source %] ([% $version %]) unstable; urgency=low + + * Version reused, new source package name. + + -- [% $author %] [% $date %] + +[% $source %] (0.5) unstable; urgency=low + + * Lintian Test Suite. + * Test: [% $testname %] + + -- [% $author %] Fri, 06 Feb 2009 22:22:37 -0800 + +[% $source %] (0) unstable; urgency=low + + * Lintian Test Suite. + * Should be ignored. + * Test: [% $testname %] + + -- [% $author %] Fri, 06 Feb 2008 22:22:37 -0800 diff --git a/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/postinst new file mode 100644 index 0000000..9a9a79c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/debian/postinst @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +# Bad +dpkg --compare-versions "$2" lt "0.5" +dpkg --compare-versions "$2" lt 0.5~ +dpkg --compare-versions "$2" lt 0.5-1~ +dpkg --compare-versions "$2" lt '0.5-1~' +dpkg --compare-versions '0.5-1~' gt "$2" +if dpkg --compare-versions '0.5-1~' gt "$2"; then :; fi + +# Good +dpkg --compare-versions "$2" lt "0" +dpkg --compare-versions "$2" lt "0~" +dpkg --compare-versions "$2" lt 0.50.5 +# This is a false-positive for 0.5 +# dpkg --compare-versions "$2" lt 0.5~ + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/fill-values new file mode 100644 index 0000000..6036e51 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/build-spec/fill-values @@ -0,0 +1,3 @@ +Testname: scripts-supports-ancient-package-version +Skeleton: upload-non-native +Description: Check for maintainer scripts supporting old versions diff --git a/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/desc b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/desc new file mode 100644 index 0000000..d58a9e1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-supports-ancient-package-version +Check: maintainer-scripts/ancient-version diff --git a/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/hints b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/hints new file mode 100644 index 0000000..0af90ca --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ancient-version/scripts-supports-ancient-package-version/eval/hints @@ -0,0 +1,6 @@ +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:9] +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:8] +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:7] +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:6] +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:11] +scripts-supports-ancient-package-version (binary): maintainer-script-supports-ancient-package-version 0.5 (2009-02-07 < 2021-08-14) [postinst:10] diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/install b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/install new file mode 100644 index 0000000..c29cc54 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/install @@ -0,0 +1,4 @@ +orphan usr/share/scripts/t1 +some-file usr/share/scripts/t1 +orphan usr/share/scripts/t2/foo +some-file usr/share/scripts/t2/foo diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/postrm new file mode 100644 index 0000000..73b8ee9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/postrm @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +if [ remove = "$1" ]; then + # Clean up the correct diversion from preinst. + dpkg-divert --package scripts-diversions --remove --rename \ + --divert /usr/share/scripts/t2/foo/some-file.real \ + "/usr/share/scripts/t2/foo/some-file" + + d=scripts + # Clean up some other diversion that we didn't create. + dpkg-divert --package scripts-diversions --remove --rename \ + /usr/lib/$d/old-file; echo hi + + # Clean up a diversion we did not create for a non-existent file. + dpkg-divert --remove --package scripts-diversions --rename \ + --divert /usr/share/scripts/$v/no-such-file.real \ + /usr/share/scripts/$v/no-such-file && echo hello + + # Clean up a diversion we did create for a non-existent file. + (dpkg-divert --package foo --remove /etc/scripts/orphan) + # another one: + { dpkg-divert --package foo --remove /usr/share/foo/$(echo bar); } +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/preinst new file mode 100644 index 0000000..c311563 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/debian/preinst @@ -0,0 +1,38 @@ +#!/bin/sh +set -e + +if [ install = "$1" ]; then + # This is a correct diversion. + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/t2/foo/some-file.real \ + /usr/share/scripts/t2/foo/some-file + + # This is broken -- can't use local. + dpkg-divert --local \ + --add \ + --divert \ + /usr/share/scripts/other-file.real \ + /usr/share/scripts/other-file + + f=orphan + # This is also correct, but we're not going to clean it up. + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/t1/$f.real \ + /usr/share/scripts/t1/"$f" + + # Try to divert a file we don't ship + dpkg-divert --package scripts-diversions --add --rename \ + --divert /etc/scripts/$f.real \ + /etc/scripts/$f|| true + # Another one + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/foo/$f.real \ + /usr/share/foo/${f#f} + + # This is correct too. + dpkg-divert $SOMETHING --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/t2/foo/some-file.real \ + /usr/share/scripts/t2/foo/some-file +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/fill-values new file mode 100644 index 0000000..a2852bf --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-diversions-variables +Description: Tests of dpkg-divert checks with variables diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/orphan b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/orphan new file mode 100644 index 0000000..934fd74 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/orphan @@ -0,0 +1 @@ +Some file that we're going to divert and not clean up. diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/some-file b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/some-file new file mode 100644 index 0000000..649e369 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/build-spec/orig/some-file @@ -0,0 +1 @@ +Some random file that we're going to install after diverting. diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/desc b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/desc new file mode 100644 index 0000000..8e33766 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-diversions-variables +Check: maintainer-scripts/diversion diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/hints b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/hints new file mode 100644 index 0000000..d32d2c6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions-variables/eval/hints @@ -0,0 +1,8 @@ +scripts-diversions-variables (binary): remove-of-unknown-diversion usr/share/scripts/*/no-such-file [postrm:18] +scripts-diversions-variables (binary): remove-of-unknown-diversion usr/lib/*/old-file [postrm:13] +scripts-diversions-variables (binary): package-uses-local-diversion [preinst:15] +scripts-diversions-variables (binary): orphaned-diversion usr/share/scripts/t1/* [preinst:21] +scripts-diversions-variables (binary): orphaned-diversion usr/share/scripts/other-file [preinst:15] +scripts-diversions-variables (binary): diversion-for-unknown-file usr/share/scripts/other-file [preinst:15] +scripts-diversions-variables (binary): diversion-for-unknown-file usr/share/foo/* [preinst:30] +scripts-diversions-variables (binary): diversion-for-unknown-file etc/scripts/* [preinst:26] diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/install b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/install new file mode 100644 index 0000000..bf6447b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/install @@ -0,0 +1,5 @@ +orphan usr/share/scripts +some-file usr/share/scripts +file.1 usr/share/scripts +foo usr/bin +foo.1p usr/share/man/man1 diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postinst new file mode 100644 index 0000000..f397e7d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# This isn't a diversion we create anywhere, but we're allowed to do this in +# postinst in case we're cleaning up after a previous version. +if [ configure = "$1" ] && dpkg-divert --list '*old-file' >/dev/null ; then + dpkg-divert --package scripts-diversions --remove --rename \ + /usr/share/scripts/old-file +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postrm new file mode 100644 index 0000000..26128e9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/postrm @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +if [ remove = "$1" ]; then + # Clean up the correct diversion from preinst. + dpkg-divert --package scripts-diversions --remove --rename \ + --divert /usr/share/scripts/some-file.real \ + /usr/share/scripts/some-file + + # Clean up some other diversion that we didn't create. + dpkg-divert --package scripts-diversions --remove --rename \ + /usr/share/scripts/old-file + + # Clean up a diversion we did create for a non-existent file. + dpkg-divert --remove --package scripts-diversions --rename \ + --divert /usr/share/scripts/no-such-file.real \ + /usr/share/scripts/no-such-file + + # Regression test for diversions ending in numbers (Bug#534942) + dpkg-divert --remove --package scripts-diversions \ + --divert /usr/share/scripts/file.1.real \ + /usr/share/scripts/file.1 > /dev/null + + # Clean up the diversion for a binary man page. + dpkg-divert --remove --package scripts-diversions \ + --divert /usr/share/man/man1/foo.real.1.gz \ + /usr/share/man/man1/foo.1.gz + + # Clean up a local diversion. + dpkg-divert --local --remove --divert /usr/share/scripts/other-file.real \ + /usr/share/scripts/other-file +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/preinst new file mode 100644 index 0000000..b590f9d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/debian/preinst @@ -0,0 +1,53 @@ +#!/bin/sh +set -e + +if [ install = "$1" ]; then + # This is a correct diversion. + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/some-file.real \ + /usr/share/scripts/some-file + + # This is broken -- can't use local. + dpkg-divert --local --add --divert /usr/share/scripts/other-file.real \ + /usr/share/scripts/other-file + + # This was broken until dpkg 1.16.0 (Wheezy), see #679132 + dpkg-divert --add --divert /usr/share/scripts/another-file.real \ + /usr/share/scripts/another-file + + # This is also correct, but we're not going to clean it up. While we're + # at it, make sure we strip trailing redirections. + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/orphan.real \ + /usr/share/scripts/orphan > /dev/null + + # The same one again, but with a different redirection. + dpkg-divert --package scripts-diversions --add --rename \ + --divert /usr/share/scripts/orphan.real \ + /usr/share/scripts/orphan 2> /dev/null + + # This is broken because the file doesn't exist. + dpkg-divert --add --package scripts-diversions --rename \ + --divert /usr/share/scripts/no-such-file.real \ + /usr/share/scripts/no-such-file + + # Regression test for diversions ending in numbers (Bug#534942) + dpkg-divert --add --rename --package scripts-diversions \ + --divert /usr/share/scripts/file.1.real \ + /usr/share/scripts/file.1 > /dev/null + + # We're allowed to divert a man page to install another man page in a + # different section but the same numeric section. (Bug#543781) + dpkg-divert --add --rename --package scripts-diversions \ + --divert /usr/share/man/man1/foo.real.1.gz \ + /usr/share/man/man1/foo.1.gz +fi + +# This isn't a diversion we create anywhere, but we're allowed to do this in +# preinst in case we're cleaning up after a previous version. +if [ upgrade = "$1" ] && dpkg-divert --list '*old-file' >/dev/null ; then + dpkg-divert --package scripts-diversions --remove --rename \ + /usr/share/scripts/old-file +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/fill-values new file mode 100644 index 0000000..df30405 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-diversions +Description: Tests of dpkg-divert checks diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/file.1 b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/file.1 new file mode 100644 index 0000000..a58ae6c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/file.1 @@ -0,0 +1 @@ +Some file ending in a number. diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo new file mode 100755 index 0000000..adff45d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo @@ -0,0 +1,2 @@ +#!/bin/sh +echo 'Fake foo binary' diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo.1p b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo.1p new file mode 100644 index 0000000..c3088fd --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/foo.1p @@ -0,0 +1,3 @@ +.TH foo 1p +.SH NAME +foo \- a fake man page for a foo diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/orphan b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/orphan new file mode 100644 index 0000000..934fd74 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/orphan @@ -0,0 +1 @@ +Some file that we're going to divert and not clean up. diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/some-file b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/some-file new file mode 100644 index 0000000..649e369 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/build-spec/orig/some-file @@ -0,0 +1 @@ +Some random file that we're going to install after diverting. diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/desc b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/desc new file mode 100644 index 0000000..bf8f64f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-diversions +Check: maintainer-scripts/diversion diff --git a/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/hints b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/hints new file mode 100644 index 0000000..d8d2444 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/diversion/scripts-diversions/eval/hints @@ -0,0 +1,8 @@ +scripts-diversions (binary): remove-of-unknown-diversion usr/share/scripts/old-file [postrm:12] +scripts-diversions (binary): package-uses-local-diversion [preinst:12] +scripts-diversions (binary): package-uses-local-diversion [postrm:31] +scripts-diversions (binary): orphaned-diversion usr/share/scripts/orphan [preinst:27] +scripts-diversions (binary): orphaned-diversion usr/share/scripts/another-file [preinst:16] +scripts-diversions (binary): diversion-for-unknown-file usr/share/scripts/other-file [preinst:12] +scripts-diversions (binary): diversion-for-unknown-file usr/share/scripts/no-such-file [preinst:32] +scripts-diversions (binary): diversion-for-unknown-file usr/share/scripts/another-file [preinst:16] diff --git a/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/postinst new file mode 100644 index 0000000..0c2e31c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# Unconditional use of dpkg-statoverride --add +dpkg-statoverride --update --add root crontab 2755 /usr/bin/crontab + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/preinst new file mode 100644 index 0000000..7c00d9c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/debian/preinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +# Conditional use of dpkg-statoverride --add +if ! dpkg-statoverride --list /usr/bin/crontab >/dev/null 2>&1 +then + dpkg-statoverride --update --add root crontab 2755 /usr/bin/crontab +fi + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/fill-values new file mode 100644 index 0000000..a2c2e15 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-unconditional-use-of-dpkg-statoverride +Description: Test for maintscripts that call dpkg-statoverride without calling --list diff --git a/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/desc b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/desc new file mode 100644 index 0000000..2294d32 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-unconditional-use-of-dpkg-statoverride +Check: maintainer-scripts/dpkg-statoverride diff --git a/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/hints b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/hints new file mode 100644 index 0000000..277f9c2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/dpkg-statoverride/scripts-unconditional-use-of-dpkg-statoverride/eval/hints @@ -0,0 +1 @@ +scripts-unconditional-use-of-dpkg-statoverride (binary): unconditional-use-of-dpkg-statoverride [postinst:8] diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/changelog.in new file mode 100644 index 0000000..a12fc8c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/changelog.in @@ -0,0 +1,57 @@ +maintainer-scripts ([% $version %]) [% $distribution %]; urgency=low + + * Doing an upload for QA but I fail to give it a correct version number, + have some uploaders, and also fail to mention it... Bad me ;) + + -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 18 Apr 2004 02:05:29 +0200 + +maintainer-scripts (6.1) unstable; urgency=low + + * I made this entry on my local PC, oops ;) + + -- Jeroen van Wolffelaar <jeroen@mordor> Sat, 21 Feb 2004 18:29:37 +0100 + +maintainer-scripts (6) unstable; urgency=low + + * added ldconfig calls to postrm to check test the postrm tests + from shared-libs + + -- Frank Lichtenheld <djpig@debian.org> Sat, 21 Feb 2004 18:29:36 +0100 + +maintainer-scripts (5) unstable; urgency=low + + * added bash style arrays to postinst, this one is for you Torsten (-: + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 30 Mar 2001 23:27:06 -0800 + +maintainer-scripts (4) unstable; urgency=low + + * added a here document to the prerm, along with two more bashisms + * made postrm a bash script to check that bash scripts are not searched + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Mon, 26 Feb 2001 13:02:57 -0800 + +maintainer-scripts (3) unstable; urgency=low + + * Added check for '.' called as '. foo || bar', lintian 1.11.15 failed this + thinking the '||' was a argument. + * also added an invalid call to '. foo bar' + * postinst now has a space between the #! and /bin/sh to test the interpreter + checking code. + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Tue, 9 Jan 2001 23:06:25 -0800 + +maintainer-scripts (2) unstable; urgency=low + + * Fix location of changelog. + * prerm and postrm do 'update-alternatives --remove'; should only complain + about postrm. + + -- Colin Watson <cjw44@flatline.org.uk> Fri, 29 Dec 2000 06:01:24 +0000 + +maintainer-scripts (1) unstable; urgency=low + + * Initial version + * postinst and prerm set the usr/doc symlink + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 16 Nov 2000 09:11:40 -0800 diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/config b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/config new file mode 100644 index 0000000..29abeba --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/config @@ -0,0 +1,3 @@ +#!/usr/bin/python + +# I use python, but that's not what I'm supposed to be allowed to use diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/control.in new file mode 100644 index 0000000..63dd2db --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/control.in @@ -0,0 +1,18 @@ +Source: maintainer-scripts +Section: misc +Priority: optional +Maintainer: QA group <packages@qa.debian.org> +Uploaders: Anyone but Jeroen <jeroen@wolffelaar.nl> +Build-Depends: [% $build_depends %] +Standards-Version: 3.1.1 +Rules-Requires-Root: binary-targets +XS-Dm-Upload-Allowed: Yes + +Package: maintainer-scripts +Architecture: [% $package_architecture %] +Depends: test +Description: test lintian's maintainer script checks + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postinst new file mode 100644 index 0000000..e56ed3b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postinst @@ -0,0 +1,181 @@ +#! /bin/sh -e + +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a -d /usr/share/doc/maintainer-scripts ]; then + ln -sf ../share/doc/maintainer-scripts /usr/doc/maintainer-scripts + fi +fi + +# valid +. /usr/share/lintian/shell || exit 0 +. /usr/share/lintian/shell >/dev/null +. /usr/share/lintian/shell 2>/dev/null +. /usr/share/lintian/shell </dev/null +. "$(dirname $0)/shell" ; bar +# invalid +. /usr/share/lintian/shell foo +. "$(dirname $0)/shell" bar + +print "Hit enter to continue" +read + +H[0]='this is a string' +echo ${H[0]} +echo "Index 0's length is ${#H[0]}" +echo "All of the array is: ${H[@]}" + +install-info /usr/share/info/foo \ + --quiet \ # make it so + --section foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +$FOO=bar +update-rc.d foo defaults >/dev/null +update-rc.d $FOO defaults +update-rc.d foo remove + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +FOO="/tmp/false.positive.XXXXXX" +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# This too is a heredoc. +some-program > /etc/config-file <<'EOF' +echo "All of the array is: ${H[@]}" +EOF + +# But this isn't. +cat '<<EOF' +echo "All of the array is: ${H[@]}" +EOF + +# This is a heredoc +cat <<-EOF +echo "All of the array is ${H[@]}" +EOF + +# As is this +cat <<';' +echo "All of the array is ${H[@]}" +; + +# and this +cat <<foo +echo "All of the array is ${H[@]}" +foobar +echo $HOSTNAME +foo + +# and again +cat <<\bar +echo "All of the array is ${H[@]}" +bar + +# yet another +cat <<"x++" +echo "All of the array is ${H[@]}" +x++ + +# Recognize single quotes even if they start at the beginning of a line. +echo not a bashism \ +'/{ptex,tex}/{amstex,plain,generic,}' + +# More bashisms. +echo -e 'foo\n' +echo "${!foo}" +cat $(\< file) +select foo in a b ; do echo $foo ; done +cnt=$((cnt + 1)) +if false ; then + exec -l /bin/sh + exec -c /bin/sh + exec -a foo /bin/sh +fi +let cnt++ +if test -a /etc/default ; then + echo "$RANDOM|stuff" +fi + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac + +/usr/bin/baz; echo bar + +# Some comment checking +# This should flag $RANDOM +test $# -gt 2 && echo $RANDOM +# But these shouldn't +test 1=1 # echo $RANDOM +(test 1=1)# echo $RANDOM +test 1=1;# echo $RANDOM +backgroundtask &#echo $RA diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postrm new file mode 100644 index 0000000..c0aaf19 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/postrm @@ -0,0 +1,47 @@ +#!/bin/bash +#set -e + +update-alternatives --remove dummy /usr/bin/dummy-alternative + +# Normally read in a maintainer script is not kosher, but here we're going +# to do it only if debconf doesn't exist. +if ! test -f /usr/share/debconf/confmodule ; then + echo "Hit enter" + read +fi + +# neither of the following should be detected as postrm-unsafe-ldconfig +# intended, without quotes + if [ "$1" = remove ]; then + ldconfig + fi +# reversed, many whitespace +if [ 'remove' = "$1" ] +then + + ldconfig +fi + +[ "remove" ="$1" ] && ldconfig + +update-rc.d bar remove + +# Shouldn't provoke an error despite no invoke-rc.d. +echo "/etc/init.d/package stop to stop something" + +# Shouldn't require a ucf dependency. Unfortunately, right now that's +# just because postrm isn't checked, not because we ensure that the +# invocation is conditional. +if which ucf >/dev/null; then + ucf --purge /etc/foo.conf +fi + +# This isn't allowed. +rm /tmp/foo /dev/device +rm /dev/device1 + +# But this is okay. +rm /tmp/foo > /dev/null + +# Not allowed here even with remove. +install-sgmlcatalog --remove package diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/preinst new file mode 100644 index 0000000..6058978 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/preinst @@ -0,0 +1,18 @@ +#!/bin/sh + +update-rc.d foo remove +update-rc.d bar defaults + +# Obsolete dpkg assertions. +dpkg --assert-support-predepends || exit 1 +dpkg --assert-working-epoch || exit 1 +dpkg --assert-long-filenames || exit 1 +dpkg --assert-multi-conrep || exit 1 + +/bin/grep -E --mmap "^Package: foo$" /var/lib/dpkg/status + +# continuation lines +update-alternatives --install /usr/bin/fakeroot fakeroot \ + /usr/bin/fakeroot-ng 5 \ + --slave /usr/share/man/man1/fakeroot.1.gz \ + fakeroot.1.gz /usr/share/man/man1/fakeroot-ng.1.gz diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/prerm new file mode 100644 index 0000000..076ecaf --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/prerm @@ -0,0 +1,188 @@ +#!/bin/sh + +if [ "$1" != "upgrade" ]; then + update-alternatives --remove dummy /usr/bin/dummy-alternative +fi + +if ([ "$1" = "upgrade" ] || [ "$1" = "remove" ]) && [ -L /usr/doc/maintainer-scripts ]; the +n + rm -f /usr/doc/maintainer-scripts +fi + +cat <<EOF +This is all really bad bash specific code!!! +read +source /bar/baz/bat foo +EOF + +# ok, back to checking +if [ "$2" == "purge" ]; then + rm -r /bar/baz +fi + +function foo( ) { + # but not here: local + local bar + echo "foo" &>/dev/null +} + +source $FOO + +trap "echo hi" EXIT HUP 3 + +if [[ "$2" = "purge" ]]; then + kill -HUP $$ +fi + +#this is ok though +if test -n $(echo foo | perl -pe 's/[[:space:]]//go'); then + echo 1 +fi + +update-rc.d foo remove + +# More false positives for bashism checks. None of these are errors. +echo "$line" | grep -q '{fonts/map,}/{\$progname,pdftex,dvips,}//' +echo "$line" | grep -q "${fonts},${foo}" +echo '$[1+2]' +printf "foo |& bar" +perl -e "print q( kill -HUP $? )" + +# Still catch disallowed expansions in double-quotes, though. +echo "${line:3:1}" + +# The wrong way to run an init script (no invoke-rc.d). +/etc/init.d/package stop + +# This is the only install-sgmlcatalog call that's allowed. +install-sgmlcatalog --quiet --remove package + +# More bashisms checks + +read -x foo +read -x +read -r foo +read foo +read + +echo "a\\b" +echo 'a\nb' + +echo "${UID}" +echo "$EUID" +echo "$SHLVL" +echo "$DIRSTACK" +echo "$SECONDS" +echo "$BASH" +echo "$BASH_FOO" +echo "$SHELLOPTS" +echo "$PIPESTATUS" + +bar="$(cut '-d|' -f2 <<< "$foo")" + +VAR=1 +VAR+=a + +echos() { + echo -n -e "bar" + echo -e -n "bar" + echo -en "bar" + echo -ne "bar" + echo "bar" + echo "echo -e foo" +} + +ech.os() { + echo foo >& 2 + echo foo >&bar + echo foo >& bar +} + +echoes() { + echo "abc\nxyz" + echo 'xyz\rabc' + echo foo\cbar + + echo -e "abc\nxyz" + echo -net 'xyz\rabc' + echo -e foo\cbar +} + +foobar.() { + suspend x + suspended x + caller x + complete x + compgen x + declare -a foo +} + +.foobar() { + typeset -x bar + disown 1 + builtin foo + set -B + alias -p + unalias -a +} + +IFS="()" + +ulimit +shopt +type -v bar +time ls +dirs +diff <(tac a) <(tac b) + +pushd + +local foo=bar +local -x foo + +popd + +readonly -f + +echo bar > /dev/tcp +export x +export -x x +export -p x + +sh -x +sh -D +sh --foo +sh +O + +# Brace expansion checks +echo {a,b} +echo {abc},{bcd} + +foobar() +{ + # This is a function +} + + foo.bar() +( + # This is a function with a bad name +) + +foobar@() +{ + # As is this +} + +# This is ok +read -r foo +# but these aren't +read -r +read -p "Would you like to restart the service?" foo bar +read --fish + +set -e + +source "$BAR" +source '$BAR' +source ~/bar +source a diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/rules new file mode 100755 index 0000000..de4161e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/rules @@ -0,0 +1,36 @@ +#!/usr/bin/make -f + +build-arch: + +build-indep: + +build: build-arch build-indep + +binary-arch: + +binary-indep: + install -d debian/tmp/DEBIAN + install -m 0755 debian/config debian/tmp/DEBIAN + install -m 0755 debian/preinst debian/tmp/DEBIAN + install -m 0755 debian/postinst debian/tmp/DEBIAN + install -m 0755 debian/prerm debian/tmp/DEBIAN + install -m 0755 debian/postrm debian/tmp/DEBIAN + install -m 0644 debian/triggers debian/tmp/DEBIAN + install -d debian/tmp/usr/share/doc/maintainer-scripts + install -m 0644 debian/changelog \ + debian/tmp/usr/share/doc/maintainer-scripts/changelog + gzip -n -9 debian/tmp/usr/share/doc/maintainer-scripts/changelog + dpkg-gencontrol -isp + dpkg --build debian/tmp .. + +binary: binary-arch binary-indep + +# Make sure we see dh_clean even in a rule clean depends on. Not the point of +# this test suite, but a convenient place to put it. +clean: clean1 clean2 clean3 +clean1: +clean2: + dh_clean +clean3: + +.PHONY: build-arch build-indep build binary-arch binary-indep binary clean diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/triggers b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/triggers new file mode 100644 index 0000000..f627094 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/triggers @@ -0,0 +1,4 @@ +# Example triggers file +activate foo + +interest bar diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/watch b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/watch new file mode 100644 index 0000000..430eea3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/debian/watch @@ -0,0 +1,11 @@ +# A whitespace is fine for uscan: + version=5 + +# Following line should not be matched: +#opts=uversionmangle=s/$/+debian/,dversionmangle=s/foo/bar/ \ +# Following one is incorrect, there's a missing backslash at the end +opts=uversionmangle=s/$/+dfsg/,dversionmangle=s/foo/bar/ + +# 'active' is useless here, but it works anyway +options=active \ +http://domain.tld/foo-(.+)\.tar\.gz
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/fill-values new file mode 100644 index 0000000..c281e87 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-non-native +Testname: legacy-maintainer-scripts +Source: maintainer-scripts +Version: 7+dfsg-0.1 +Description: Legacy test "maintainer-scripts" +Extra-Build-Depends: dash (>= 0.5.10.2) diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/desc b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/desc new file mode 100644 index 0000000..1aed5d1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-maintainer-scripts +Check: maintainer-scripts/empty diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/hints b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/hints new file mode 100644 index 0000000..e7789b1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/hints @@ -0,0 +1 @@ +maintainer-scripts (binary): maintainer-script-empty [config] diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/post-test b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/post-test new file mode 100644 index 0000000..faeef0b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-maintainer-scripts/eval/post-test @@ -0,0 +1 @@ +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/changelog.in new file mode 100644 index 0000000..935c633 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/changelog.in @@ -0,0 +1,41 @@ +scripts ([% $version %]) [% $distribution %]; urgency=low + + * I'm also not able to write my name. + * Added a script in /etc/Xsession.d + * Bizarre version number courtesy of + https://wiki.ubuntu.com/SecurityUpdateProcedures#Prepare + + -- Mark 'HE' Brokschmitt <he@debian.org> Thu, 23 Jun 2005 14:32:39 +0200 + +scripts (5-1) unstable; urgency=low + + * I'm making a typo in my own name... And I want lintian to warn me about + it. + + -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 18 Apr 2004 02:26:34 +0200 + +scripts (4-1) unstable; urgency=low + + * Add new example to check that not executable files with a shebang line + called *in don't trigger the script-not-executable warning. + + -- Marc 'HE' Brockschmidt <he@debian.org> Wed, 14 Apr 2004 19:44:04 +0200 + +scripts (3-3) unstable; urgency=low + + * Add suidperlfoo and some code in debian/rules to + check the new suidperl checks + + -- Frank Lichtenheld <djpig@debian.org> Wed, 31 Mar 2004 21:06:20 +0000 + +scripts (2-1) unstable; urgency=low + + * Add tkfoo script for tk checkings + + -- Lintian Maintainers <lintian-maint@debian.org> Sat, 21 Feb 2004 17:13:36 +0100 + +scripts (1-0) unstable; urgency=low + + * Initial version + + -- Lintian Maintainers <lintian-maint@debian.org> Sat, 10 Feb 2001 15:37:31 -0800 diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/control.in new file mode 100644 index 0000000..ef39375 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/control.in @@ -0,0 +1,16 @@ +Source: scripts +Section: interpreters +Priority: optional +Maintainer: Lintian Maintainers <lintian-maint@debian.org> +Uploaders: Jeroen van Wolfelaar <jeroen@wolffelaar.nl>, Marc 'HE' Brockschmidt <he@debian.org> +Build-Depends-Indep: python3 (>= 3.1), python3 (<< 3.2), dpatch +Standards-Version: 3.2.1 + +Package: scripts +Architecture: [% $package_architecture %] +Depends: test, ruby1.8, build-essential, libssl0.9.7, php7.0-cli +Recommends: tk8.4 | wish +Description: test lintian's script file checks + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/copyright b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/copyright new file mode 100644 index 0000000..ad8a119 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/copyright @@ -0,0 +1,5 @@ +This file contains the phrase "under the same terms as Perl itself" to +trigger warnings about not having common-licenses references. + +This file contains the phrase "public domain" which should suppress +warnings about no copyright date. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list new file mode 100644 index 0000000..3b9d37e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list @@ -0,0 +1,11 @@ +01_not_here_right_now.dpatch + +# some comment +/* some more + elaborate comment + which needs DPATCH_OPTION_CPP=1 + */02_i_dont_have_a_description.patch 03_specified_without_dpatch + +// and again a comment + +04_i_dont_have_a_description_either.patch diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list.sparc b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list.sparc new file mode 100644 index 0000000..8b47ab3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00list.sparc @@ -0,0 +1 @@ +01_some_other_patch_thats_not_in_the_package.dpatch diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00options b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00options new file mode 100644 index 0000000..57ffeb6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/00options @@ -0,0 +1 @@ +DPATCH_OPTION_CPP=1 diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/02_i_dont_have_a_description.patch b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/02_i_dont_have_a_description.patch new file mode 100644 index 0000000..9279c1b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/02_i_dont_have_a_description.patch @@ -0,0 +1,7 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02_i_dont_have_a_description.patch.dpatch by Marc 'HE' Brockschmidt <Marc 'HE' Brockschmidt <he@debian.org>> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/03_specified_without_dpatch.dpatch b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/03_specified_without_dpatch.dpatch new file mode 100644 index 0000000..8303ac6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/03_specified_without_dpatch.dpatch @@ -0,0 +1,5 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## All lines beginning with `## DP:' are a description of the patch. +## DP: Listed in 00list without .dpatch suffix. + +@DPATCH@ diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/04_i_dont_have_a_description_either.patch b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/04_i_dont_have_a_description_either.patch new file mode 100644 index 0000000..b603f16 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/patches/04_i_dont_have_a_description_either.patch @@ -0,0 +1,7 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 04_i_dont_have_a_description_either.patch by Adam D. Barratt <adam@adam-barratt.org.uk> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: + +@DPATCH@ diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postinst new file mode 100644 index 0000000..7c5baf1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postinst @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -x "/etc/init.d/lsb-broken" ] ; then + update-rc.d lsb-broken defaults >/dev/null +fi +if [ -x "/etc/init.d/no-lsb" ] ; then + update-rc.d no-lsb defaults >/dev/null +fi +if [ -x "/etc/init.d/skeleton" ] ; then + update-rc.d skeleton defaults >/dev/null +fi +if [ -x "/etc/init.d/lsb-other" ] ; then + update-rc.d lsb-other defaults >/dev/null +fi diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postrm new file mode 100644 index 0000000..8fa75a2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh -e + +if [ "$1" = purge ] ; then + update-rc.d lsb-broken remove >/dev/null + update-rc.d no-lsb remove >/dev/null + update-rc.d skeleton remove >/dev/null + update-rc.d lsb-other remove >/dev/null + update-rc.d lsb-other remove >/dev/null +fi diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/preinst new file mode 100644 index 0000000..0799557 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/preinst @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e +set -x + +# +# Some comments here +# + +# This serves as an example of an "empty" script, so +# please do not add any real code here, thank you :) + +#DEBHELPER# + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/rules new file mode 100755 index 0000000..dc6b7d5 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/rules @@ -0,0 +1,111 @@ +#!/usr/bin/make -f + +tmp=debian/tmp + +build-arch: + echo "Hi, in an arch: all package, I am a bug!" + +build-indep: + +build: build-arch build-indep + +binary-arch: + echo "Hi, in an arch: all package, I am a bug!" + +binary-indep: + install -d $(tmp)/usr/bin/ + install -d $(tmp)/etc/X11/Xsession.d/ + install -d $(tmp)/etc/init.d/ + install -d $(tmp)/etc/csh/login.d/ + install -d $(tmp)/etc/fish.d/ + install -d $(tmp)/usr/share/scripts/ + install -d $(tmp)/usr/share/doc/scripts/ + install -d $(tmp)/usr/lib/cgi-bin + install -d $(tmp)/usr/src/scripts + install -d $(tmp)/DEBIAN + + install -m 755 csh-foo $(tmp)/etc/csh/login.d/ + install -m 755 envfoo $(tmp)/usr/bin/ + install -m 755 fish-foo $(tmp)/etc/fish.d/ + install -m 755 jruby-broken $(tmp)/usr/bin/ + install -m 755 py3.Xfoo $(tmp)/usr/bin/ +# This uses "env" and should trigger script-in-usr-share-doc + install -m 755 py3.Xfoo $(tmp)/usr/share/doc/scripts/ + install -m 755 py3foo $(tmp)/usr/bin/ +# This uses "env" and should trigger script-in-usr-share-doc + install -m 755 py3foo $(tmp)/usr/share/doc/scripts/ + install -m 755 perlfoo $(tmp)/usr/bin/ + install -m 755 rubyfoo $(tmp)/usr/bin/ +# This doesn't use "env" but should also trigger script-in-usr-share-doc + install -m 755 rubyfoo $(tmp)/usr/share/doc/scripts/ + install -m 755 make-foo $(tmp)/usr/bin/ + install -m 755 lefty-foo $(tmp)/usr/bin/ + install -m 4751 perlfoo $(tmp)/usr/bin/suidperlfoo2 + install -m 755 sh-broken $(tmp)/usr/bin/ + install -m 4555 suidperlfoo $(tmp)/usr/bin/ + install -m 755 tkfoo $(tmp)/usr/bin/ + install -m 755 wishfoo $(tmp)/usr/bin/ + install -m 644 xsession-test $(tmp)/etc/X11/Xsession.d/ + +# Permissions here aren't part of what's being tested, but let us exercise +# some other errors. + install -m 755 perl-bizarre-1 $(tmp)/usr/bin/ + install -m 750 perl-bizarre-2 $(tmp)/usr/bin/ + install -m 754 perl-bizarre-3 $(tmp)/usr/bin/ + install -m 705 guile-bizarre $(tmp)/usr/bin/ + +# First one should produce a warning; second one shouldn't. + install -m 755 gccbug.dpatch $(tmp)/usr/share/scripts/ + install -m 755 gccbug.dpatch $(tmp)/usr/src/scripts/ + + install -m 644 init-skeleton $(tmp)/etc/init.d/skeleton + install -m 755 init-no-lsb $(tmp)/etc/init.d/no-lsb + install -m 755 init-lsb-broken $(tmp)/etc/init.d/lsb-broken + install -m 755 init-lsb-other $(tmp)/etc/init.d/lsb-other + + install -m 755 phpfoo $(tmp)/usr/share/scripts/ + sed 's/php$$/php7.0/' phpfoo > $(tmp)/usr/share/scripts/php7.0foo + chmod 755 $(tmp)/usr/share/scripts/php7.0foo + + install -m 755 phpenvfoo $(tmp)/usr/share/scripts/ + sed 's/php$$/php7.0/' phpenvfoo > $(tmp)/usr/share/scripts/php7.0envfoo + chmod 755 $(tmp)/usr/share/scripts/php7.0envfoo + + echo "#!/usr/bin/perl" >> $(tmp)/usr/share/scripts/foobar.in + chmod 644 $(tmp)/usr/share/scripts/foobar.in + + touch $(tmp)/usr/share/scripts/mono.exe + chmod 755 $(tmp)/usr/share/scripts/mono.exe + + echo "#!/bin/sh" > $(tmp)/usr/share/scripts/foo\$$bar + chmod 755 $(tmp)/usr/share/scripts/foo\$$bar + + echo "#!/bin/sh" > $(tmp)/usr/lib/cgi-bin/cgi-script + chmod 755 $(tmp)/usr/lib/cgi-bin/cgi-script + + echo "#!/bin/sh" > $(tmp)/usr/bin/test.sh + chmod 755 $(tmp)/usr/bin/test.sh + + + dh_testroot # dummy to test missing debhelper dependency + + + install -m 644 debian/changelog $(tmp)/usr/share/doc/scripts/changelog.Debian + gzip -n -9 $(tmp)/usr/share/doc/scripts/changelog.Debian + install -m 644 debian/copyright $(tmp)/usr/share/doc/scripts/copyright + + install -m 644 debian/scripts.conffiles $(tmp)/DEBIAN/conffiles + install -m 755 debian/preinst $(tmp)/DEBIAN/preinst + install -m 755 debian/postinst $(tmp)/DEBIAN/postinst + install -m 755 debian/postrm $(tmp)/DEBIAN/postrm + touch $(tmp)/DEBIAN/prerm + chmod 755 $(tmp)/DEBIAN/prerm + dpkg-gencontrol -isp + dpkg --build $(tmp) .. + +binary: binary-arch binary-indep + +clean: + rm -rf debian/files $(tmp) debian/substvars + +.PHONY: build-arch build-indep build binary-arch binary-indep binary clean diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/scripts.conffiles b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/scripts.conffiles new file mode 100644 index 0000000..01a371a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/scripts.conffiles @@ -0,0 +1,6 @@ +/etc/init.d/lsb-broken +/etc/init.d/lsb-other +/etc/init.d/no-lsb +/etc/X11/Xsession.d/xsession-test +/etc/csh/login.d/csh-foo +/etc/fish.d/fish-foo diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/watch b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/watch new file mode 100644 index 0000000..dba5815 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/debian/watch @@ -0,0 +1,8 @@ +# watch file with upstream version mangling + +version=2 +opts="uversionmangle=s/$/ds/" \ +http://qa.debian.org/watch/sf.php?project=foo scripts\.([\d.]+)\.tar\.gz debian uupdate + +version=3 +http://ftp.sf.net/foo/foo_bar(.+)\.Z 5 uupdate
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/fill-values new file mode 100644 index 0000000..8a68457 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/fill-values @@ -0,0 +1,6 @@ +Testname: legacy-scripts +Source: scripts +Version: 6ds-1ubuntu0.5.10.1 +Package-Architecture: all +Skeleton: upload-non-native +Description: Legacy test "scripts" diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/csh-foo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/csh-foo new file mode 100644 index 0000000..eaf47a1 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/csh-foo @@ -0,0 +1,2 @@ +#! /bin/csh + diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/envfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/envfoo new file mode 100755 index 0000000..e005037 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/envfoo @@ -0,0 +1,4 @@ +#! /bin/env python + +if __name__ == '__main__': + print 'Hi there' diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/fish-foo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/fish-foo new file mode 100644 index 0000000..7f59139 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/fish-foo @@ -0,0 +1,2 @@ +#! /usr/bin/fish + diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/gccbug.dpatch b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/gccbug.dpatch new file mode 100755 index 0000000..65cbf37 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/gccbug.dpatch @@ -0,0 +1,39 @@ +#! /bin/sh -e + +# DP: Use sensible-editor instead of vi as fallback editor + +# Taken from gcc-4.1-source. Chokes bash -n (due to the patch) despite being +# a valid dpatch, so don't warn about it if it's in /usr/src. + +dir= +if [ $# -eq 3 -a "$2" = '-d' ]; then + pdir="-d $3" + dir="$3/" +elif [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) + patch $pdir -f --no-backup-if-mismatch -p0 < $0 + ;; + -unpatch) + patch $pdir -f --no-backup-if-mismatch -R -p0 < $0 + ;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +--- gcc/gccbug.in~ 2003-03-01 00:51:42.000000000 +0100 ++++ gcc/gccbug.in 2003-03-02 12:08:36.000000000 +0100 +@@ -134,7 +134,7 @@ + # If they don't have a preferred editor set, then use + if [ -z "$VISUAL" ]; then + if [ -z "$EDITOR" ]; then +- EDIT=vi ++ EDIT=/usr/bin/sensible-editor + else + EDIT="$EDITOR" + fi diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/guile-bizarre b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/guile-bizarre new file mode 100644 index 0000000..70e2c74 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/guile-bizarre @@ -0,0 +1,6 @@ +#! /bin/sh +# -*- scheme -*- +exec guile -s $0 $* +# Seen in the wild as build-guile-gtk in libguilegtk-1.2-dev (0.31-5.1) +# Tests script_is_evil_and_wrong +!# diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-broken b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-broken new file mode 100644 index 0000000..e4dfa92 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-broken @@ -0,0 +1,34 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: bad-lsb +# Required-Start: $local_fs $remote_fs +# Required-Stop: +# Default-Start: 1 2 3 4 5 +# Default-Stop: S 0 1 6 X +# 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). +# This one is too (with tabs). +# X-Debian-Foo: Some unknown but valid keyword. +# Foo: Some invalid keyword. + +# Whoops, no terminating line. + +# And then we have this duplicate section. +### BEGIN INIT INFO +# Required-Start: This one doesn't count. +### END INIT INFO + +# Hey, look at all of those missing actions! But stop isn't missing. +case "$1" in + start|stop) + echo "Blah" + ;; + *) + echo "Usage: foo start" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-other b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-other new file mode 100644 index 0000000..adb4795 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-lsb-other @@ -0,0 +1,22 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: lsb-other +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: This is another LSB script test, which has a missing +# Short-Description. +### END INIT INFO + +case "$1" in + start|stop|restart|reload|force-reload) + echo "Blah" + ;; + *) + echo "Usage: foo start" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-no-lsb b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-no-lsb new file mode 100644 index 0000000..6b994dd --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-no-lsb @@ -0,0 +1,17 @@ +#! /bin/sh +# No LSB section, but otherwise okay. (Well, the messages are bad, but we +# don't check that yet.) + +case "$1" in + start) + echo "Blah starting" + ;; + stop) + echo "Blah stopping" + ;; + restart|force-reload) + echo "Blah restarting" + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-skeleton b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-skeleton new file mode 100644 index 0000000..c868508 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/init-skeleton @@ -0,0 +1,150 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: skeleton +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: Example Lintian initscript +# Description: This file should be used to construct scripts to be +# placed in /etc/init.d. +### END INIT INFO + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/usr/sbin:/usr/bin:/sbin:/bin +DESC="Description of the service" +NAME=daemonexecutablename +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="--options args" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +[ -f /etc/default/rcS ] && . /etc/default/rcS + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/jruby-broken b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/jruby-broken new file mode 100644 index 0000000..56f574d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/jruby-broken @@ -0,0 +1,2 @@ +#!/usr/bin/jruby +# There's no non-versioned jruby, so this should be an error. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/lefty-foo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/lefty-foo new file mode 100644 index 0000000..52c003e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/lefty-foo @@ -0,0 +1,2 @@ +#!/usr/local/bin/lefty + diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/make-foo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/make-foo new file mode 100644 index 0000000..6b787b5 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/make-foo @@ -0,0 +1,3 @@ +#!/usr/bin/make + + diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-1 b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-1 new file mode 100644 index 0000000..fc632c8 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-1 @@ -0,0 +1,11 @@ +#! /bin/sh +eval '(exit $?0)' && eval 'PERL_BADLANG=x;export PERL_BADLANG;: \ +;exec perl -x -S -- "$0" ${1+"$@"};#'if 0; +eval 'setenv PERL_BADLANG x;exec perl -x -S -- "$0" $argv:q;#'.q+ +#!perl -w +package Htex::a2ping; $0=~/(.*)/s;unshift@INC,'.';do($1);die$@if$@;__END__+if !1; +# This Perl script was generated by JustLib2 at Wed Apr 23 09:14:13 2003. +# Don't touch/remove any lines above; http://www.inf.bme.hu/~pts/justlib + +# The above was actually seen in the wild and stresses the +# script_is_evil_and_wrong test. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-2 b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-2 new file mode 100644 index 0000000..afd9cfe --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-2 @@ -0,0 +1,7 @@ +#!/bin/sh +eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}' + if $running_under_some_shell; + +# I'm someone following perlrun except without using the Perl #! line. +# Now something to choke bash. +while (<>) { if (/%#/) { print } } diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-3 b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-3 new file mode 100644 index 0000000..44baf75 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perl-bizarre-3 @@ -0,0 +1,6 @@ +eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}' +& eval 'exec /usr/bin/perl -wS $0 $argv:q' + if $running_under_some_shell; + +# More utterly bizarreness from perlrun. This one even doesn't work if +# there's a valid #! line on the first line. I don't understand why.... diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perlfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perlfoo new file mode 100644 index 0000000..5b27ed0 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/perlfoo @@ -0,0 +1,3 @@ +#! /usr/bin/perl + +print "Hello, World!"; diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpenvfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpenvfoo new file mode 100644 index 0000000..cbbfb2e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpenvfoo @@ -0,0 +1,7 @@ +#!/usr/bin/env php +<html> +<head> +<title>Dumb PHP script</title> +</head> +<body><? print(Date("l F d, Y")); ?></body> +</html> diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpfoo new file mode 100644 index 0000000..e0595e6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/phpfoo @@ -0,0 +1,7 @@ +#!/usr/bin/php +<html> +<head> +<title>Dumb PHP script</title> +</head> +<body><? print(Date("l F d, Y")); ?></body> +</html> diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3.Xfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3.Xfoo new file mode 100755 index 0000000..7f105e6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3.Xfoo @@ -0,0 +1,4 @@ +#! /usr/bin/env python3.7 + +if __name__ == '__main__': + print 'Hi there' diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3foo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3foo new file mode 100755 index 0000000..02b0444 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/py3foo @@ -0,0 +1,4 @@ +#! /usr/bin/env python3 + +if __name__ == '__main__': + print 'Hi there' diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/rubyfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/rubyfoo new file mode 100644 index 0000000..8024605 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/rubyfoo @@ -0,0 +1,4 @@ +#!/bin/ruby1.8 + +# Ok, that example is really pathetic, but until we have +# some better code in checks/scripts, it will do diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/sh-broken b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/sh-broken new file mode 100644 index 0000000..7b79074 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/sh-broken @@ -0,0 +1,2 @@ +#!/bin/sh +if fi diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/suidperlfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/suidperlfoo new file mode 100644 index 0000000..bcbc471 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/suidperlfoo @@ -0,0 +1,3 @@ +#! /usr/bin/suidperl + +print "Hello, World!"; diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/tkfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/tkfoo new file mode 100755 index 0000000..533595a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/tkfoo @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Insane amount of empty lines and comments + +# +# +# +# + +# +# + +# +# +# + +# +# + +# +# This line makes the next one a comment in Tcl \ +exec wish "$0" -- ${1+"$@"} + +# lintian should not check the following for syntax +# if it detects the line above correctly +# Code snippet taken from eTkTab + +if { [array names prefs keybindings] != "" } { + # Read in the file + array set unparsed_bindings [ read_settings_file $prefs(keybindings)] +} diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/wishfoo b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/wishfoo new file mode 100644 index 0000000..035c9ad --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/wishfoo @@ -0,0 +1,4 @@ +#!/usr/bin/wish +# +# This is not actually a wish script, here to force a test of wish +# dependencies. diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/xsession-test b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/xsession-test new file mode 100644 index 0000000..ca49d72 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/orig/xsession-test @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Foo." diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/pre-build b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/pre-build new file mode 100755 index 0000000..b5649a8 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/build-spec/pre-build @@ -0,0 +1,5 @@ +#!/bin/sh + +DIR="$1" + +rm -f "$DIR/debian/compat" diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/desc b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/desc new file mode 100644 index 0000000..b65a18e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-scripts +Check: maintainer-scripts/empty diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/hints b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/hints new file mode 100644 index 0000000..66ad6ff --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/hints @@ -0,0 +1 @@ +scripts (binary): maintainer-script-empty [preinst] diff --git a/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/post-test b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/post-test new file mode 100644 index 0000000..faeef0b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/legacy-scripts/eval/post-test @@ -0,0 +1 @@ +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postinst new file mode 100644 index 0000000..b5f5ca7 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postinst @@ -0,0 +1,41 @@ +#!/bin/sh +# postinst script for generic-dh-make-2008 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postrm new file mode 100644 index 0000000..1d8a18a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/postrm @@ -0,0 +1,39 @@ +#!/bin/sh +# postrm script for generic-dh-make-2008 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/preinst new file mode 100644 index 0000000..3134ccf --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/preinst @@ -0,0 +1,37 @@ +#!/bin/sh +# preinst script for generic-dh-make-2008 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <new-preinst> `install' +# * <new-preinst> `install' <old-version> +# * <new-preinst> `upgrade' <old-version> +# * <old-preinst> `abort-upgrade' <new-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/prerm new file mode 100644 index 0000000..4e5dd3f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/debian/prerm @@ -0,0 +1,40 @@ +#!/bin/sh +# prerm script for generic-dh-make-2008 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <prerm> `remove' +# * <old-prerm> `upgrade' <new-version> +# * <new-prerm> `failed-upgrade' <old-version> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> +# * <deconfigured's-prerm> `deconfigure' `in-favour' +# <package-being-installed> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/fill-values new file mode 100644 index 0000000..bcdea9d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-maintainer-script-empty +Description: Test for empty maintainer scripts diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/desc b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/desc new file mode 100644 index 0000000..c4bfcc2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-maintainer-script-empty +Check: maintainer-scripts/empty diff --git a/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/hints b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/hints new file mode 100644 index 0000000..30b3a5f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/empty/scripts-maintainer-script-empty/eval/hints @@ -0,0 +1,4 @@ +scripts-maintainer-script-empty (binary): maintainer-script-empty [prerm] +scripts-maintainer-script-empty (binary): maintainer-script-empty [preinst] +scripts-maintainer-script-empty (binary): maintainer-script-empty [postrm] +scripts-maintainer-script-empty (binary): maintainer-script-empty [postinst] diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/control.in new file mode 100644 index 0000000..55acbe7 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/control.in @@ -0,0 +1,63 @@ +Source: [% $source %] +Priority: optional +Section: [% $section %] +Maintainer: [% $author %] +Standards-Version: [% $standards_version %] +Build-Depends: [% $build_depends %] +Rules-Requires-Root: no + +Package: [% $source %]-paths +Architecture: [% $package_architecture %] +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (paths) + Interpreters with bad paths. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: [% $source %]-forbidden +Architecture: [% $package_architecture %] +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (forbidden) + Forbidden control interpreters. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: [% $source %]-unknown +Architecture: [% $package_architecture %] +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (unknown) + Unknown control interpreters. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: [% $source %]-python +Architecture: [% $package_architecture %] +Depends: python, ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (Python) + Python control interpreters with depends. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: [% $source %]-prepython +Architecture: [% $package_architecture %] +Pre-Depends: python +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (Python preinst) + Python control interpreters with pre-depends. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/POTFILES.in b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/POTFILES.in new file mode 100644 index 0000000..5da079f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] scripts-control-interpreters-forbidden.templates diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/de.po b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/de.po new file mode 100644 index 0000000..4ab3a8f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/de.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-12-28 14:30-0800\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. description +#: ../scripts-control-interpreters-forbidden.templates:1001 +msgid "Enter something:" +msgstr "Not really a translation:" diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/templates.pot b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/templates.pot new file mode 100644 index 0000000..6b4af20 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/po/templates.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-12-28 14:30-0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. description +#: ../scripts-control-interpreters-forbidden.templates:1001 +msgid "Enter something:" +msgstr "" diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-forbidden.templates b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-forbidden.templates new file mode 100644 index 0000000..05d97b3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-forbidden.templates @@ -0,0 +1,3 @@ +Template: scripts-control-interpreters-forbidden/test +Type: string +_description: Enter something: diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.postinst new file mode 100644 index 0000000..39cf003 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.postinst @@ -0,0 +1,5 @@ +#!/usr/bin/bash +set -e +run something + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.preinst b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.preinst new file mode 100644 index 0000000..542236f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.preinst @@ -0,0 +1,5 @@ +#!/usr/local/bin/bash +set -e +run something + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.prerm b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.prerm new file mode 100644 index 0000000..b2c6828 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-paths.prerm @@ -0,0 +1,6 @@ +#!/bin/python +import sys +sys.exit(0) +""" +#DEBHELPER# +""" diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-unknown.postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-unknown.postinst new file mode 100644 index 0000000..a5ded5a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/debian/scripts-control-interpreters-unknown.postinst @@ -0,0 +1,6 @@ +#!/usr/bin/unknown +do the unknown thing +shellicate this stuff ( +#DEBHELPER# +) yay! +exit happily diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/fill-values new file mode 100644 index 0000000..99b7449 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-control-interpreters +Description: Check maintainer and config script interpreters diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/desc b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/desc new file mode 100644 index 0000000..5dfc2c3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/desc @@ -0,0 +1,3 @@ +Testname: scripts-control-interpreters +See-Also: Debian Bug#508307 +Check: maintainer-scripts/generated diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/hints b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/hints new file mode 100644 index 0000000..daa8447 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/hints @@ -0,0 +1 @@ +scripts-control-interpreters-forbidden (binary): debhelper-autoscript-in-maintainer-scripts dh_installdebconf/TOOL-VERSION diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/post-test b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/post-test new file mode 100644 index 0000000..6205e14 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-control-interpreters/eval/post-test @@ -0,0 +1 @@ +s,/.*,/TOOL-VERSION, diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/maintscript b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/maintscript new file mode 100644 index 0000000..c3dcfac --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/maintscript @@ -0,0 +1 @@ +mv_conffile /etc/foo/old.conf /etc/foo/new.conf 0~ diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postinst new file mode 100755 index 0000000..492f84a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postinst @@ -0,0 +1,255 @@ +#!/bin/sh + +# This file contains a pile of random junk in maintainer scripts that we +# should be checking for in checks/scripts. Don't put bashisms in this file, +# though; those should go into scripts-bashisms. + +set -e + +print "Hit enter to continue" +read foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated and not allowed except the second one. +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +# The first should not trigger an error about a command with a path, but the +# second should. +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac +/usr/bin/baz; echo bar + +# fc-cache shouldn't be called directly, but make sure we don't see it in a +# heredoc. +fc-cache +cat <<EOF +fc-cache +EOF + +# Obsolete suidregister program. +suidregister /usr/bin/foo + +# install-info is now handled through triggers. +install-info --quiet --section Development Development \ + /usr/share/info/foobar.info + +# Packages don't get to modify /etc/ld.so.conf +echo '/usr/local/lib' >> /etc/ld.so.conf +( cat /etc/ld.so.conf ; echo '/usr/local/lib' ) > /etc/ld.so.conf.new +mv /etc/ld.so.conf.new /etc/ld.so.conf + +# Further tests for commands with paths in maintainer scripts. The following +# should not trigger a tag (Bug#536397). +chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2 + +# These, however, should. +true `basename "$0"` `/usr/bin/foo bar` +true `/usr/bin/foo "$0"` + +# This line should not trigger a warning about no dependency on ucf because of +# the || true. (Bug#541372) +ucf -p /etc/sensors3.conf || true + +if false ; then + mknod some thing +fi + +# Calling update alternative --set see #643602 +update-alternatives --set editor /usr/bin/nano + +# false positive +start-stop-daemon--stop --quiet --name foo --startas /usr/bin/foo + +# false positive +start-stop-daemon --quiet --stop --name foo --startas /usr/bin/foo + +# false negative +start-stop-daemon --quiet --start --name foo --startas /usr/bin/foo + +# remove device file +rm /dev/null + +# false positive +rm /dev/shm/test +rm /dev/.hiddenfile + +# adduser system +adduser --system foo +adduser --system foo2 --home /home/foo2 +adduser --system bar --home /var/lib/bar +adduser --home /var/lib/fnord --system fnord +adduser --home /home/fnord2 --system fnord2 + +# other test case for gconftool +/usr/bin/gconftool-2 --makefile-install-rule foo.schema + +# service +service apache2 start + +# adduser through variable +DEVNULL=/dev/null +adduser --system bar1 --home $DEVNULL +adduser --system bar2 --home ${DEVNULL} + +# this is a false positive due to quoting +adduser --system bar2 --home "${DEVNULL}" +adduser --system --ingroup smmta --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Transfer Agent' smmta; + +# false positive +echo "You can use update-alternatives --config runsystem to select" +echo "the runsystem to use." + +# false negative +DIVERSIONS=`env LC_ALL=C /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL="C" /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL='C' /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true + +if [ ! -x /usr/sbin/dpkg-state-override ] || \ + ! dpkg-state-override > /dev/null +then + true; +fi + +# bad +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html/ \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# good +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# true positive +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 + +chown root:root /good +chmod 777 /good +chown -R root:root /bad +chown root:root -R /bad +chown root:root --recursive /bad +chown --recursive root:root /bad +chmod -R 777 /bad +chmod 777 -R /bad +chmod 777 --recursive /bad +chmod --recursive 777 /bad +find /bad -maxdepth 2 -type d -exec chown root:root {} \; # (#895370) +find /bad -maxdepth 2 -type d -exec chmod 777 # (#895370) + +echo /var/lib/dpkg/info/other-package.conffiles +echo /var/lib/dpkg/info/other-package.md5sums +echo /var/lib/dpkg/info/other-package.shlibs +echo /var/lib/dpkg/info/other-package.postinst +echo /var/lib/dpkg/info/other-package.preinst +echo /var/lib/dpkg/info/other-package.list +echo /var/lib/dpkg/triggers/other-package + +getent passwd good || true +getent group good || true +getent passwd good || true # grep /etc/passwd false-positive +getent group good || true # grep /etc/group false-positive +grep bad /etc/passwd || true +grep bad /etc/group || true +grep -E bad /etc/passwd || true +grep -E bad /etc/passwd || true +grep -F bad /etc/group || true +grep -F bad /etc/group || true +# grep /etc/passwd false-positive +# grep /etc/group false-positive + +echo $PIUPARTS_TEST # bad +echo ${PIUPARTS_OBJECTS} +echo ${PIUPARTS_PHASE} +echo ${PIUPARTS_DISTRIBUTION} +echo ${PIUPARTS_DISTRIBUTION_NEXT} +echo ${PIUPARTS_DISTRIBUTION_PREV} +echo $PIUPARTS_IS_AWESOME # good + +#DEBHELPER# + +# Automatically added by dh_dummy/12 +true `/usr/bin/false-positive "$0"` +# End automatically added section diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postrm new file mode 100644 index 0000000..21ce89e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +# we do not set -e + +echo "ok" > /dev/null + +# not allowed +update-alternatives --remove foo + +#DEBHELPER#
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/prerm new file mode 100644 index 0000000..fcbd64e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +# This script should fail a syntax check + +if [ "$1" = configure ] then # oh look - I forgot a ; + echo "Hallo world" +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/rules new file mode 100644 index 0000000..6f66b82 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_installdeb: + dh_installdeb + echo "#DEBHELPER#" >> debian/$(shell dh_listpackages)/DEBIAN/postinst diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/fill-values new file mode 100644 index 0000000..111edec --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: scripts-maintainer-general +Distribution: precise +Description: Check general problems in maintainer scripts diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/desc b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/desc new file mode 100644 index 0000000..53a4676 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/desc @@ -0,0 +1,4 @@ +Testname: scripts-maintainer-general +Profile: ubuntu/main +See-Also: Debian Bug#532984 +Check: maintainer-scripts/generated diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/hints b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/hints new file mode 100644 index 0000000..e5cee75 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/hints @@ -0,0 +1,2 @@ +scripts-maintainer-general (binary): debhelper-autoscript-in-maintainer-scripts dh_installdeb/TOOL-VERSION +scripts-maintainer-general (binary): debhelper-autoscript-in-maintainer-scripts dh_dummy/TOOL-VERSION diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/post-test b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/post-test new file mode 100644 index 0000000..6205e14 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-general/eval/post-test @@ -0,0 +1 @@ +s,/.*,/TOOL-VERSION, diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/debian/postinst new file mode 100644 index 0000000..1004a3a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/debian/postinst @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +#DEBHELPER# +# Automatically added by dh_fake_lintian_tool +if [ "$1" = configure ]; then + echo do something ... +fi +# End automatically added section + +# Automatically added by dh_fake_lintian_tool_versioned/1.0 +if [ "$1" = configure ]; then + echo do something ... +fi +# End automatically added section + +# dh_python tools adds a ":" after for some reason. Ignore it +# Automatically added by dh_fake_python3: +if [ "$1" = configure ]; then + echo do something else ... +fi +# End automatically added section + +# Again, now pretending it has a version +# Automatically added by dh_fake_python3_versioned/1.0: +if [ "$1" = configure ]; then + echo do something else ... +fi +# End automatically added section + + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/fill-values new file mode 100644 index 0000000..53ff431 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-maintainer-script-classification +Description: Test for classification tags in maintscripts diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/desc b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/desc new file mode 100644 index 0000000..bd8e63d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-maintainer-script-classification +Check: maintainer-scripts/generated diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/hints b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/hints new file mode 100644 index 0000000..b2d78f7 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/hints @@ -0,0 +1,4 @@ +scripts-maintainer-script-classification (binary): debhelper-autoscript-in-maintainer-scripts dh_fake_python3_versioned/TOOL-VERSION +scripts-maintainer-script-classification (binary): debhelper-autoscript-in-maintainer-scripts dh_fake_python3 +scripts-maintainer-script-classification (binary): debhelper-autoscript-in-maintainer-scripts dh_fake_lintian_tool_versioned/TOOL-VERSION +scripts-maintainer-script-classification (binary): debhelper-autoscript-in-maintainer-scripts dh_fake_lintian_tool diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/post-test b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/post-test new file mode 100644 index 0000000..6205e14 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-maintainer-script-classification/eval/post-test @@ -0,0 +1 @@ +s,/.*,/TOOL-VERSION, diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/install b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/install new file mode 100644 index 0000000..4690206 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/install @@ -0,0 +1 @@ +foo.afm usr/share/fonts/X11/Type1 diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/postinst new file mode 100644 index 0000000..ea5884d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/debian/postinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if false +then + update-fonts-dir manual + update-fonts-scale manual +fi diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/fill-values new file mode 100644 index 0000000..37d3c47 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-missing-call-to-update-fonts-unrel +Description: Check missing calls to update-fonts (false-positives) diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/orig/foo.afm b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/orig/foo.afm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/build-spec/orig/foo.afm diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/desc b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/desc new file mode 100644 index 0000000..dac6811 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-missing-call-to-update-fonts-unrel +Check: maintainer-scripts/generated diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/hints b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/hints new file mode 100644 index 0000000..7d1fdc6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/hints @@ -0,0 +1 @@ +scripts-missing-call-to-update-fonts-unrel (binary): debhelper-autoscript-in-maintainer-scripts dh_installxfonts/TOOL-VERSION diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/post-test b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/post-test new file mode 100644 index 0000000..6205e14 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts-unrel/eval/post-test @@ -0,0 +1 @@ +s,/.*,/TOOL-VERSION, diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/install b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/install new file mode 100644 index 0000000..4690206 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/install @@ -0,0 +1 @@ +foo.afm usr/share/fonts/X11/Type1 diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/postinst new file mode 100644 index 0000000..72a8dfb --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/debian/postinst @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if false +then + echo "Deliberately not including DEBHELPER snippet." +fi diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/fill-values new file mode 100644 index 0000000..4b17473 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-missing-call-to-update-fonts +Description: Check missing calls to update-fonts diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/orig/foo.afm b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/orig/foo.afm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/build-spec/orig/foo.afm diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/desc b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/desc new file mode 100644 index 0000000..409b93d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-missing-call-to-update-fonts +Check: maintainer-scripts/generated diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/hints b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/hints new file mode 100644 index 0000000..9fbef2c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/hints @@ -0,0 +1 @@ +scripts-missing-call-to-update-fonts (binary): debhelper-autoscript-in-maintainer-scripts dh_installxfonts/TOOL-VERSION diff --git a/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/post-test b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/post-test new file mode 100644 index 0000000..6205e14 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/generated/scripts-missing-call-to-update-fonts/eval/post-test @@ -0,0 +1 @@ +s,/.*,/TOOL-VERSION, diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/maintscript b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/maintscript new file mode 100644 index 0000000..c3dcfac --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/maintscript @@ -0,0 +1 @@ +mv_conffile /etc/foo/old.conf /etc/foo/new.conf 0~ diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postinst new file mode 100755 index 0000000..492f84a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postinst @@ -0,0 +1,255 @@ +#!/bin/sh + +# This file contains a pile of random junk in maintainer scripts that we +# should be checking for in checks/scripts. Don't put bashisms in this file, +# though; those should go into scripts-bashisms. + +set -e + +print "Hit enter to continue" +read foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated and not allowed except the second one. +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +# The first should not trigger an error about a command with a path, but the +# second should. +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac +/usr/bin/baz; echo bar + +# fc-cache shouldn't be called directly, but make sure we don't see it in a +# heredoc. +fc-cache +cat <<EOF +fc-cache +EOF + +# Obsolete suidregister program. +suidregister /usr/bin/foo + +# install-info is now handled through triggers. +install-info --quiet --section Development Development \ + /usr/share/info/foobar.info + +# Packages don't get to modify /etc/ld.so.conf +echo '/usr/local/lib' >> /etc/ld.so.conf +( cat /etc/ld.so.conf ; echo '/usr/local/lib' ) > /etc/ld.so.conf.new +mv /etc/ld.so.conf.new /etc/ld.so.conf + +# Further tests for commands with paths in maintainer scripts. The following +# should not trigger a tag (Bug#536397). +chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2 + +# These, however, should. +true `basename "$0"` `/usr/bin/foo bar` +true `/usr/bin/foo "$0"` + +# This line should not trigger a warning about no dependency on ucf because of +# the || true. (Bug#541372) +ucf -p /etc/sensors3.conf || true + +if false ; then + mknod some thing +fi + +# Calling update alternative --set see #643602 +update-alternatives --set editor /usr/bin/nano + +# false positive +start-stop-daemon--stop --quiet --name foo --startas /usr/bin/foo + +# false positive +start-stop-daemon --quiet --stop --name foo --startas /usr/bin/foo + +# false negative +start-stop-daemon --quiet --start --name foo --startas /usr/bin/foo + +# remove device file +rm /dev/null + +# false positive +rm /dev/shm/test +rm /dev/.hiddenfile + +# adduser system +adduser --system foo +adduser --system foo2 --home /home/foo2 +adduser --system bar --home /var/lib/bar +adduser --home /var/lib/fnord --system fnord +adduser --home /home/fnord2 --system fnord2 + +# other test case for gconftool +/usr/bin/gconftool-2 --makefile-install-rule foo.schema + +# service +service apache2 start + +# adduser through variable +DEVNULL=/dev/null +adduser --system bar1 --home $DEVNULL +adduser --system bar2 --home ${DEVNULL} + +# this is a false positive due to quoting +adduser --system bar2 --home "${DEVNULL}" +adduser --system --ingroup smmta --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Transfer Agent' smmta; + +# false positive +echo "You can use update-alternatives --config runsystem to select" +echo "the runsystem to use." + +# false negative +DIVERSIONS=`env LC_ALL=C /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL="C" /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL='C' /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true + +if [ ! -x /usr/sbin/dpkg-state-override ] || \ + ! dpkg-state-override > /dev/null +then + true; +fi + +# bad +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html/ \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# good +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# true positive +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 + +chown root:root /good +chmod 777 /good +chown -R root:root /bad +chown root:root -R /bad +chown root:root --recursive /bad +chown --recursive root:root /bad +chmod -R 777 /bad +chmod 777 -R /bad +chmod 777 --recursive /bad +chmod --recursive 777 /bad +find /bad -maxdepth 2 -type d -exec chown root:root {} \; # (#895370) +find /bad -maxdepth 2 -type d -exec chmod 777 # (#895370) + +echo /var/lib/dpkg/info/other-package.conffiles +echo /var/lib/dpkg/info/other-package.md5sums +echo /var/lib/dpkg/info/other-package.shlibs +echo /var/lib/dpkg/info/other-package.postinst +echo /var/lib/dpkg/info/other-package.preinst +echo /var/lib/dpkg/info/other-package.list +echo /var/lib/dpkg/triggers/other-package + +getent passwd good || true +getent group good || true +getent passwd good || true # grep /etc/passwd false-positive +getent group good || true # grep /etc/group false-positive +grep bad /etc/passwd || true +grep bad /etc/group || true +grep -E bad /etc/passwd || true +grep -E bad /etc/passwd || true +grep -F bad /etc/group || true +grep -F bad /etc/group || true +# grep /etc/passwd false-positive +# grep /etc/group false-positive + +echo $PIUPARTS_TEST # bad +echo ${PIUPARTS_OBJECTS} +echo ${PIUPARTS_PHASE} +echo ${PIUPARTS_DISTRIBUTION} +echo ${PIUPARTS_DISTRIBUTION_NEXT} +echo ${PIUPARTS_DISTRIBUTION_PREV} +echo $PIUPARTS_IS_AWESOME # good + +#DEBHELPER# + +# Automatically added by dh_dummy/12 +true `/usr/bin/false-positive "$0"` +# End automatically added section diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postrm new file mode 100644 index 0000000..21ce89e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +# we do not set -e + +echo "ok" > /dev/null + +# not allowed +update-alternatives --remove foo + +#DEBHELPER#
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/prerm new file mode 100644 index 0000000..fcbd64e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +# This script should fail a syntax check + +if [ "$1" = configure ] then # oh look - I forgot a ; + echo "Hallo world" +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/rules new file mode 100644 index 0000000..6f66b82 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_installdeb: + dh_installdeb + echo "#DEBHELPER#" >> debian/$(shell dh_listpackages)/DEBIAN/postinst diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/fill-values new file mode 100644 index 0000000..111edec --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: scripts-maintainer-general +Distribution: precise +Description: Check general problems in maintainer scripts diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/desc b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/desc new file mode 100644 index 0000000..64058f6 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/desc @@ -0,0 +1,5 @@ +Testname: scripts-maintainer-general +Profile: ubuntu/main +Check: maintainer-scripts/helper/dpkg +See-Also: + Bug#532984 diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/hints b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/hints new file mode 100644 index 0000000..be09dc2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-maintainer-general/eval/hints @@ -0,0 +1,2 @@ +scripts-maintainer-general (binary): missing-call-to-dpkg-maintscript-helper symlink_to_dir [preinst] +scripts-maintainer-general (binary): missing-call-to-dpkg-maintscript-helper symlink_to_dir [postrm] diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/postinst new file mode 100644 index 0000000..fb6d516 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/postinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +dpkg-maintscript-helper symlink_to_dir /path/name /old/target 1.0-1 scripts-missing-call-to-dpkg-maintscript-helper + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/preinst new file mode 100644 index 0000000..fb6d516 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/debian/preinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +dpkg-maintscript-helper symlink_to_dir /path/name /old/target 1.0-1 scripts-missing-call-to-dpkg-maintscript-helper + +exit 0 diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/fill-values new file mode 100644 index 0000000..cbe62e2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-missing-call-to-dpkg-maintscript-helper +Description: Test for packages that miss calls to dpkg-maintscript-helper(1) diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/desc b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/desc new file mode 100644 index 0000000..6864600 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-missing-call-to-dpkg-maintscript-helper +Check: maintainer-scripts/helper/dpkg diff --git a/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/hints b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/hints new file mode 100644 index 0000000..dca6cfb --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/helper/dpkg/scripts-missing-call-to-dpkg-maintscript-helper/eval/hints @@ -0,0 +1 @@ +scripts-missing-call-to-dpkg-maintscript-helper (binary): missing-call-to-dpkg-maintscript-helper symlink_to_dir [postrm] diff --git a/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/debian/postinst new file mode 100644 index 0000000..0e052fe --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/debian/postinst @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +killall fish + +#DEBHELPER# + diff --git a/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/fill-values new file mode 100644 index 0000000..7d78e3c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: scripts-killall +Description: Test for killall usage in maint script diff --git a/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/desc b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/desc new file mode 100644 index 0000000..2596c48 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/desc @@ -0,0 +1,2 @@ +Testname: scripts-killall +Check: maintainer-scripts/killall diff --git a/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/hints b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/hints new file mode 100644 index 0000000..7b1c62e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/killall/scripts-killall/eval/hints @@ -0,0 +1 @@ +scripts-killall (binary): killall-is-dangerous [postinst:5] diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/changelog.in new file mode 100644 index 0000000..f5e308e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/changelog.in @@ -0,0 +1,6 @@ +debconf ([% $version %]) [% $distribution %]; urgency=low + + * Initial Release + * Changelog line with exactly 80 characters which tests the line-too-long tag. + + -- Lintian Maintainers <debian-lint-maint@debian.org> Wed, 3 May 2006 18:07:19 -0500 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/compat.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/compat.in new file mode 100644 index 0000000..640a566 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/compat.in @@ -0,0 +1 @@ +[% $dh_compat_level %] diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/control b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/control new file mode 100644 index 0000000..bf9f4e9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/control @@ -0,0 +1,52 @@ +Source: debconf +Section: utils +Priority: optional +Build-Depends: debhelper (>= 4), dpatch +Maintainer: Lintian Maintainers <debian-lint-maint@debian.org> +Standards-Version: 3.7.2 + +Package: debconf-test +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test package for the debconf checks of lintian (dummy) + +Package: debconf-test-noscripts +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test package for the debconf checks of lintian (noscripts) + Package missing postinst/postrm/config. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: debconf-test-preinst +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test package for the debconf checks of lintian (preinst) + Package uses debconf only in preinst. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: debconf-test-postinst +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Test package for the debconf checks of lintian (postinst) + Package uses debconf only in postinst. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + +Package: debconf-udeb +Section: debian-installer +XC-Package-Type: udeb +XB-Installer-Menu-Item: 100 +Architecture: any +Depends: ${shlibs:Depends} +Description: Test udeb package for the debconf checks of lintian (dummy) diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/copyright b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/copyright new file mode 100644 index 0000000..84843ee --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/copyright @@ -0,0 +1,10 @@ +Copyright (C) 2004 Frank Lichtenheld <djpig@debian.org> + +Test for really old FSF address: + +Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +MA 02139, USA. + +Test for a dh-make boilerplate: +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-noscripts.templates b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-noscripts.templates new file mode 100644 index 0000000..93f8071 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-noscripts.templates @@ -0,0 +1,3 @@ +Template: debconf/test +Type: text +_description: Foo bar (1) diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postinst new file mode 100644 index 0000000..56ab871 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postinst @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +. /usr/share/debconf/confmodule + +db_input medium debconf/test + +#DEBHELPER# + +true diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postrm b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postrm new file mode 100644 index 0000000..cbf5e3b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.postrm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.templates b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.templates new file mode 100644 index 0000000..2a2a8ab --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-postinst.templates @@ -0,0 +1,3 @@ +Template: debconf/test +Type: text +_description: Enter something: diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.postrm b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.postrm new file mode 100644 index 0000000..cbf5e3b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.postrm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.preinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.preinst new file mode 100644 index 0000000..bf6f074 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.preinst @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +# Obsolete name for the confmodule +. /usr/share/debconf/confmodule.sh + +. /usr/share/debconf/confmodule + +db_input medium debconf/test + +#DEBHELPER# + +true diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.templates b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.templates new file mode 100644 index 0000000..2a2a8ab --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test-preinst.templates @@ -0,0 +1,3 @@ +Template: debconf/test +Type: text +_description: Enter something: diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.config b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.config new file mode 100644 index 0000000..9e32d06 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.config @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +db_settitle "Funky lintian test" + +# Bad priorities. +db_text LOW debconf/test +db_input normal debconf/test + +# Valid priorities. +db_text \ +high debconf/test +foo=medium +db_input $foo debconf/test +db_input "$foo" debconf/test +db_input 'medium' debconf/test + +# debconf/transtring should not be flagged as unused +# (it's aliased to debconf/alias, which is used) +db_register debconf/transtring debconf/alias +db_input medium debconf/alias diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.postinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.postinst new file mode 100644 index 0000000..b387037 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +# Not supposed to do this here. +db_input medium debconf/test + +true diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates new file mode 100644 index 0000000..811bb6c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates @@ -0,0 +1,101 @@ +Template: debconf/test +Type: text +_description: Foo bar (1) + +Template: debconf/testmulti +Type: multiselect +__Choices: foo, bar, boo +_Description: test comma usages in choices fields + +Template: debconf/testmulti-escape +Type: multiselect +_Choices: foo\, bar, boo +_Description: test escaped comma usages in choices fields: + +Template: debconf/testboolean +Type: boolean +_Description: Enter yes or no: + Do you want to answer this question? + +Template: debconf/teststring +Type: string +_Description: This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + This template goes on and on. + +Template: debconf/testnote +Type: note +Description: This should be a title and not a really long sentence that ends in a regular period. + +Template: debconf/1st-person +Type: select +__Choices: one, two +_Description: Select one of these: + I am a stupid test of first-person syntax that tells you to select yes + even though yes isn't an option in this prompt. + +Template: debconf/internal +Type: boolean +Description: For internal use only + We are testing that style checks are not applied to templates that are + marked as internal. + +Template: debconf/no-description +Type: string + +Template: debconf/translate +Type: boolean +_Default: false +_Description: Should this really be translated? + +Template: debconf/transtring +Type: string +_Default: 1 +_Description: Count of templates: + The number of useless numbers that a translator would have to translate + for this template. + +Template: debconf/language +__Choices: English, Spanish, German, French +# This is the default choice. Translators should put their own language, +# if available, here instead, but the value MUST be the English version +# of the value for the package scripts to work properly. +_Default: English[ translators, see the comment in the PO files] +_Description: The default language, an example of a default that should + be translated. + +Template: debconf/error +Type: error +_Description: An error occurred + This is a sample Debconf error template. + +Template: debconf/should-be-boolean +Type: select +__Choices: yes, no +_Description: Choose: + Pick yes or no. + +Template: debconf/should-be-no-longer-a-problem +Type: boolean +_Description: Decide, lintian + Using "no longer" should no longer be detected as + making-assumptions-about-interfaces-in-templates by lintian. diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.de b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.de new file mode 100644 index 0000000..f9ea121 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.de @@ -0,0 +1,3 @@ +Template: debconf/testmulti +Type: multiselect +Choices: foo, bar\, boo, boo diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-test.templates.in diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.postinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.postinst new file mode 100644 index 0000000..4ce41f0 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.postinst @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +ldconfig + +true diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.templates b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.templates new file mode 100644 index 0000000..5d7cf5a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/debconf-udeb.templates @@ -0,0 +1,3 @@ +Template: debian-installer/debconf-udeb/title +Type: text +_description: This is just a test diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/POTFILES.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/POTFILES.in new file mode 100644 index 0000000..d0c82f0 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/POTFILES.in @@ -0,0 +1,2 @@ +[type: gettext/rfc822deb] debconf-test.templates +[type: gettext/rfc822deb] debconf-udeb.templates diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/de.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/de.po new file mode 100644 index 0000000..86c5796 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/de.po @@ -0,0 +1,66 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +msgid "" +msgstr "" +"Project-Id-Version: debconf-test 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: 2004-12-06 01:01+0100\n" +"Last-Translator: Frank Lichtenheld <djpig@debian.org>\n" +"Language-Team: debian-l10n-german@l.d.o\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "foo" +msgstr "foo" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "bar" +msgstr "bar, boo" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "boo" +msgstr "boo" + +#. Type: multiselect +#. Description +#: ../debconf-test.templates:8 +msgid "test comma usages in choices fields" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:11 +msgid "foo\\, bar, boo" +msgstr "foo, bar, boo" + +#. Type: text +#. description +#: ../debconf-udeb.templates:3 +msgid "This is just a test" +msgstr "Dies ist nur ein Test" diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/fr.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/fr.po new file mode 100644 index 0000000..c74deb2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/fr.po @@ -0,0 +1,60 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +msgid "" +msgstr "" +"Project-Id-Version: debconf-test 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: 2005-10-13 15:03+0200\n" +"Last-Translator: Frank Lichtenheld <djpig@debian.org>\n" +"Language-Team: debian-l10n-german@l.d.o\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "foo" +msgstr "foo" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "bar" +msgstr "bar, boo" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "boo" +msgstr "boo" + +#. Type: multiselect +#. Description +#: ../debconf-test.templates:8 +msgid "test comma usages in choices fields" +msgstr "" + +#. Type: text +#. description +#: ../debconf-udeb.templates:3 +msgid "This is just a test" +msgstr " diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/lang.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/lang.po new file mode 100644 index 0000000..7ac498a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/lang.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "" +"Project-Id-Version: debconf-test 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: 2005-10-13 15:03+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/nds.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/nds.po new file mode 100644 index 0000000..7ac498a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/nds.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "" +"Project-Id-Version: debconf-test 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: 2005-10-13 15:03+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/output b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/output new file mode 100644 index 0000000..c3df1a5 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/output @@ -0,0 +1 @@ +2 utf8 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/pt_BR.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/pt_BR.po new file mode 100644 index 0000000..7ac498a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/pt_BR.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "" +"Project-Id-Version: debconf-test 1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: 2005-10-13 15:03+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/sample-file.po b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/sample-file.po new file mode 100644 index 0000000..8dcc0ff --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/sample-file.po @@ -0,0 +1 @@ +This is some file that isn't actually a valid .po file. diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/templates.pot b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/templates.pot new file mode 100644 index 0000000..914c77f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/po/templates.pot @@ -0,0 +1,61 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2004-12-06 00:51+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. description +#: ../debconf-test.templates:3 +msgid "Foo bar (2)" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "foo" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "bar" +msgstr "" + +#. Type: multiselect +#. Choices +#: ../debconf-test.templates:7 +msgid "boo" +msgstr "" + +#. Type: multiselect +#. Description +#: ../debconf-test.templates:8 +msgid "test comma usages in choices fields" +msgstr "" + +#. Type: text +#. description +#: ../debconf-udeb.templates:3 +msgid "This is just a test" +msgstr "" diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pycompat b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pycompat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pyversions b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pyversions new file mode 100644 index 0000000..6f290b0 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/pyversions @@ -0,0 +1 @@ +>= 2.7 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/rules new file mode 100755 index 0000000..933901a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/debian/rules @@ -0,0 +1,64 @@ +#!/usr/bin/make -f + +deb_dir = debian/debconf +udeb_dir = debian/debconf-udeb +build_dirs = $(deb_dir) $(udeb_dir) + +build-indep: +# There are no architecture-independent files to be built +# by this package. If there were any they would be made +# here. + +build-arch: + dh_testdir + touch build + +build: build-indep build-arch + +clean: + dh_testdir + dh_testroot + -rm -f build + + dh_clean + +binary-indep: build +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs -a + + dh_installchangelogs -a + dh_installdocs -a + dh_installdebconf -pdebconf-test + dh_installdebconf -pdebconf-test-noscripts --noscripts + dh_installdebconf -pdebconf-test-preinst --noscripts + dh_installdebconf -pdebconf-test-postinst --noscripts + dh_installdebconf -pdebconf-udeb + + + + + dh_compress -a + dh_fixperms -a + +# The shlibs stuff doesn't matter here so do it in a weird order to +# test warnings. + dh_installdeb -a + dh_shlibdeps -a + dh_makeshlibs -a + dh_gencontrol -a + dh_md5sums + dh_builddeb -a + dh_makeshlibs -a + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +.PHONY: build-arch build-indep build binary binary-arch binary-indep clean checkroot diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/fill-values new file mode 100644 index 0000000..186615f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-native +Testname: legacy-debconf +Source: debconf +Version: 1~rc1 +Description: Legacy test "debconf" +Default-Build-Depends: debhelper (>= [% $dh_compat_level %]~) diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/desc b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/desc new file mode 100644 index 0000000..511d56c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-debconf +Check: maintainer-scripts/ldconfig diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/hints b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/hints new file mode 100644 index 0000000..4f765cb --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/hints @@ -0,0 +1 @@ +debconf-udeb (udeb): udeb-postinst-calls-ldconfig [postinst] diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/post-test b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/post-test new file mode 100644 index 0000000..faeef0b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-debconf/eval/post-test @@ -0,0 +1 @@ +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/changelog.in new file mode 100644 index 0000000..a12fc8c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/changelog.in @@ -0,0 +1,57 @@ +maintainer-scripts ([% $version %]) [% $distribution %]; urgency=low + + * Doing an upload for QA but I fail to give it a correct version number, + have some uploaders, and also fail to mention it... Bad me ;) + + -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 18 Apr 2004 02:05:29 +0200 + +maintainer-scripts (6.1) unstable; urgency=low + + * I made this entry on my local PC, oops ;) + + -- Jeroen van Wolffelaar <jeroen@mordor> Sat, 21 Feb 2004 18:29:37 +0100 + +maintainer-scripts (6) unstable; urgency=low + + * added ldconfig calls to postrm to check test the postrm tests + from shared-libs + + -- Frank Lichtenheld <djpig@debian.org> Sat, 21 Feb 2004 18:29:36 +0100 + +maintainer-scripts (5) unstable; urgency=low + + * added bash style arrays to postinst, this one is for you Torsten (-: + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 30 Mar 2001 23:27:06 -0800 + +maintainer-scripts (4) unstable; urgency=low + + * added a here document to the prerm, along with two more bashisms + * made postrm a bash script to check that bash scripts are not searched + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Mon, 26 Feb 2001 13:02:57 -0800 + +maintainer-scripts (3) unstable; urgency=low + + * Added check for '.' called as '. foo || bar', lintian 1.11.15 failed this + thinking the '||' was a argument. + * also added an invalid call to '. foo bar' + * postinst now has a space between the #! and /bin/sh to test the interpreter + checking code. + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Tue, 9 Jan 2001 23:06:25 -0800 + +maintainer-scripts (2) unstable; urgency=low + + * Fix location of changelog. + * prerm and postrm do 'update-alternatives --remove'; should only complain + about postrm. + + -- Colin Watson <cjw44@flatline.org.uk> Fri, 29 Dec 2000 06:01:24 +0000 + +maintainer-scripts (1) unstable; urgency=low + + * Initial version + * postinst and prerm set the usr/doc symlink + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 16 Nov 2000 09:11:40 -0800 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/control.in new file mode 100644 index 0000000..63dd2db --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/control.in @@ -0,0 +1,18 @@ +Source: maintainer-scripts +Section: misc +Priority: optional +Maintainer: QA group <packages@qa.debian.org> +Uploaders: Anyone but Jeroen <jeroen@wolffelaar.nl> +Build-Depends: [% $build_depends %] +Standards-Version: 3.1.1 +Rules-Requires-Root: binary-targets +XS-Dm-Upload-Allowed: Yes + +Package: maintainer-scripts +Architecture: [% $package_architecture %] +Depends: test +Description: test lintian's maintainer script checks + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postinst new file mode 100644 index 0000000..e56ed3b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postinst @@ -0,0 +1,181 @@ +#! /bin/sh -e + +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a -d /usr/share/doc/maintainer-scripts ]; then + ln -sf ../share/doc/maintainer-scripts /usr/doc/maintainer-scripts + fi +fi + +# valid +. /usr/share/lintian/shell || exit 0 +. /usr/share/lintian/shell >/dev/null +. /usr/share/lintian/shell 2>/dev/null +. /usr/share/lintian/shell </dev/null +. "$(dirname $0)/shell" ; bar +# invalid +. /usr/share/lintian/shell foo +. "$(dirname $0)/shell" bar + +print "Hit enter to continue" +read + +H[0]='this is a string' +echo ${H[0]} +echo "Index 0's length is ${#H[0]}" +echo "All of the array is: ${H[@]}" + +install-info /usr/share/info/foo \ + --quiet \ # make it so + --section foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +$FOO=bar +update-rc.d foo defaults >/dev/null +update-rc.d $FOO defaults +update-rc.d foo remove + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +FOO="/tmp/false.positive.XXXXXX" +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# This too is a heredoc. +some-program > /etc/config-file <<'EOF' +echo "All of the array is: ${H[@]}" +EOF + +# But this isn't. +cat '<<EOF' +echo "All of the array is: ${H[@]}" +EOF + +# This is a heredoc +cat <<-EOF +echo "All of the array is ${H[@]}" +EOF + +# As is this +cat <<';' +echo "All of the array is ${H[@]}" +; + +# and this +cat <<foo +echo "All of the array is ${H[@]}" +foobar +echo $HOSTNAME +foo + +# and again +cat <<\bar +echo "All of the array is ${H[@]}" +bar + +# yet another +cat <<"x++" +echo "All of the array is ${H[@]}" +x++ + +# Recognize single quotes even if they start at the beginning of a line. +echo not a bashism \ +'/{ptex,tex}/{amstex,plain,generic,}' + +# More bashisms. +echo -e 'foo\n' +echo "${!foo}" +cat $(\< file) +select foo in a b ; do echo $foo ; done +cnt=$((cnt + 1)) +if false ; then + exec -l /bin/sh + exec -c /bin/sh + exec -a foo /bin/sh +fi +let cnt++ +if test -a /etc/default ; then + echo "$RANDOM|stuff" +fi + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac + +/usr/bin/baz; echo bar + +# Some comment checking +# This should flag $RANDOM +test $# -gt 2 && echo $RANDOM +# But these shouldn't +test 1=1 # echo $RANDOM +(test 1=1)# echo $RANDOM +test 1=1;# echo $RANDOM +backgroundtask &#echo $RA diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postrm new file mode 100644 index 0000000..c0aaf19 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/postrm @@ -0,0 +1,47 @@ +#!/bin/bash +#set -e + +update-alternatives --remove dummy /usr/bin/dummy-alternative + +# Normally read in a maintainer script is not kosher, but here we're going +# to do it only if debconf doesn't exist. +if ! test -f /usr/share/debconf/confmodule ; then + echo "Hit enter" + read +fi + +# neither of the following should be detected as postrm-unsafe-ldconfig +# intended, without quotes + if [ "$1" = remove ]; then + ldconfig + fi +# reversed, many whitespace +if [ 'remove' = "$1" ] +then + + ldconfig +fi + +[ "remove" ="$1" ] && ldconfig + +update-rc.d bar remove + +# Shouldn't provoke an error despite no invoke-rc.d. +echo "/etc/init.d/package stop to stop something" + +# Shouldn't require a ucf dependency. Unfortunately, right now that's +# just because postrm isn't checked, not because we ensure that the +# invocation is conditional. +if which ucf >/dev/null; then + ucf --purge /etc/foo.conf +fi + +# This isn't allowed. +rm /tmp/foo /dev/device +rm /dev/device1 + +# But this is okay. +rm /tmp/foo > /dev/null + +# Not allowed here even with remove. +install-sgmlcatalog --remove package diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/preinst new file mode 100644 index 0000000..6058978 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/preinst @@ -0,0 +1,18 @@ +#!/bin/sh + +update-rc.d foo remove +update-rc.d bar defaults + +# Obsolete dpkg assertions. +dpkg --assert-support-predepends || exit 1 +dpkg --assert-working-epoch || exit 1 +dpkg --assert-long-filenames || exit 1 +dpkg --assert-multi-conrep || exit 1 + +/bin/grep -E --mmap "^Package: foo$" /var/lib/dpkg/status + +# continuation lines +update-alternatives --install /usr/bin/fakeroot fakeroot \ + /usr/bin/fakeroot-ng 5 \ + --slave /usr/share/man/man1/fakeroot.1.gz \ + fakeroot.1.gz /usr/share/man/man1/fakeroot-ng.1.gz diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/prerm new file mode 100644 index 0000000..076ecaf --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/prerm @@ -0,0 +1,188 @@ +#!/bin/sh + +if [ "$1" != "upgrade" ]; then + update-alternatives --remove dummy /usr/bin/dummy-alternative +fi + +if ([ "$1" = "upgrade" ] || [ "$1" = "remove" ]) && [ -L /usr/doc/maintainer-scripts ]; the +n + rm -f /usr/doc/maintainer-scripts +fi + +cat <<EOF +This is all really bad bash specific code!!! +read +source /bar/baz/bat foo +EOF + +# ok, back to checking +if [ "$2" == "purge" ]; then + rm -r /bar/baz +fi + +function foo( ) { + # but not here: local + local bar + echo "foo" &>/dev/null +} + +source $FOO + +trap "echo hi" EXIT HUP 3 + +if [[ "$2" = "purge" ]]; then + kill -HUP $$ +fi + +#this is ok though +if test -n $(echo foo | perl -pe 's/[[:space:]]//go'); then + echo 1 +fi + +update-rc.d foo remove + +# More false positives for bashism checks. None of these are errors. +echo "$line" | grep -q '{fonts/map,}/{\$progname,pdftex,dvips,}//' +echo "$line" | grep -q "${fonts},${foo}" +echo '$[1+2]' +printf "foo |& bar" +perl -e "print q( kill -HUP $? )" + +# Still catch disallowed expansions in double-quotes, though. +echo "${line:3:1}" + +# The wrong way to run an init script (no invoke-rc.d). +/etc/init.d/package stop + +# This is the only install-sgmlcatalog call that's allowed. +install-sgmlcatalog --quiet --remove package + +# More bashisms checks + +read -x foo +read -x +read -r foo +read foo +read + +echo "a\\b" +echo 'a\nb' + +echo "${UID}" +echo "$EUID" +echo "$SHLVL" +echo "$DIRSTACK" +echo "$SECONDS" +echo "$BASH" +echo "$BASH_FOO" +echo "$SHELLOPTS" +echo "$PIPESTATUS" + +bar="$(cut '-d|' -f2 <<< "$foo")" + +VAR=1 +VAR+=a + +echos() { + echo -n -e "bar" + echo -e -n "bar" + echo -en "bar" + echo -ne "bar" + echo "bar" + echo "echo -e foo" +} + +ech.os() { + echo foo >& 2 + echo foo >&bar + echo foo >& bar +} + +echoes() { + echo "abc\nxyz" + echo 'xyz\rabc' + echo foo\cbar + + echo -e "abc\nxyz" + echo -net 'xyz\rabc' + echo -e foo\cbar +} + +foobar.() { + suspend x + suspended x + caller x + complete x + compgen x + declare -a foo +} + +.foobar() { + typeset -x bar + disown 1 + builtin foo + set -B + alias -p + unalias -a +} + +IFS="()" + +ulimit +shopt +type -v bar +time ls +dirs +diff <(tac a) <(tac b) + +pushd + +local foo=bar +local -x foo + +popd + +readonly -f + +echo bar > /dev/tcp +export x +export -x x +export -p x + +sh -x +sh -D +sh --foo +sh +O + +# Brace expansion checks +echo {a,b} +echo {abc},{bcd} + +foobar() +{ + # This is a function +} + + foo.bar() +( + # This is a function with a bad name +) + +foobar@() +{ + # As is this +} + +# This is ok +read -r foo +# but these aren't +read -r +read -p "Would you like to restart the service?" foo bar +read --fish + +set -e + +source "$BAR" +source '$BAR' +source ~/bar +source a diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/rules new file mode 100755 index 0000000..5fcef00 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/rules @@ -0,0 +1,35 @@ +#!/usr/bin/make -f + +build-arch: + +build-indep: + +build: build-arch build-indep + +binary-arch: + +binary-indep: + install -d debian/tmp/DEBIAN + install -m 0755 debian/preinst debian/tmp/DEBIAN + install -m 0755 debian/postinst debian/tmp/DEBIAN + install -m 0755 debian/prerm debian/tmp/DEBIAN + install -m 0755 debian/postrm debian/tmp/DEBIAN + install -m 0644 debian/triggers debian/tmp/DEBIAN + install -d debian/tmp/usr/share/doc/maintainer-scripts + install -m 0644 debian/changelog \ + debian/tmp/usr/share/doc/maintainer-scripts/changelog + gzip -n -9 debian/tmp/usr/share/doc/maintainer-scripts/changelog + dpkg-gencontrol -isp + dpkg --build debian/tmp .. + +binary: binary-arch binary-indep + +# Make sure we see dh_clean even in a rule clean depends on. Not the point of +# this test suite, but a convenient place to put it. +clean: clean1 clean2 clean3 +clean1: +clean2: + dh_clean +clean3: + +.PHONY: build-arch build-indep build binary-arch binary-indep binary clean diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/triggers b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/triggers new file mode 100644 index 0000000..f627094 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/triggers @@ -0,0 +1,4 @@ +# Example triggers file +activate foo + +interest bar diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/watch b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/watch new file mode 100644 index 0000000..430eea3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/debian/watch @@ -0,0 +1,11 @@ +# A whitespace is fine for uscan: + version=5 + +# Following line should not be matched: +#opts=uversionmangle=s/$/+debian/,dversionmangle=s/foo/bar/ \ +# Following one is incorrect, there's a missing backslash at the end +opts=uversionmangle=s/$/+dfsg/,dversionmangle=s/foo/bar/ + +# 'active' is useless here, but it works anyway +options=active \ +http://domain.tld/foo-(.+)\.tar\.gz
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/fill-values new file mode 100644 index 0000000..c281e87 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-non-native +Testname: legacy-maintainer-scripts +Source: maintainer-scripts +Version: 7+dfsg-0.1 +Description: Legacy test "maintainer-scripts" +Extra-Build-Depends: dash (>= 0.5.10.2) diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/desc b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/desc new file mode 100644 index 0000000..4b4c6eb --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-maintainer-scripts +Check: maintainer-scripts/ldconfig diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/hints b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/hints new file mode 100644 index 0000000..e02cca8 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/hints @@ -0,0 +1 @@ +maintainer-scripts (binary): maintscript-calls-ldconfig [postrm] diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/post-test b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/post-test new file mode 100644 index 0000000..faeef0b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/legacy-maintainer-scripts/eval/post-test @@ -0,0 +1 @@ +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.install b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.install new file mode 100644 index 0000000..fe6951d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.install @@ -0,0 +1,2 @@ +app usr/lib/app + diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postinst b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postinst new file mode 100755 index 0000000..3e67b7e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +ldconfig + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postrm b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postrm new file mode 100755 index 0000000..eaeb28d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.postrm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +if [ "$1" = remove ] ; then ldconfig ; fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.triggers b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.triggers new file mode 100644 index 0000000..dd86603 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/app.triggers @@ -0,0 +1 @@ +activate-noawait ldconfig diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/compat.in b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/compat.in new file mode 100644 index 0000000..640a566 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/compat.in @@ -0,0 +1 @@ +[% $dh_compat_level %] diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/control.in new file mode 100644 index 0000000..9960ee9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/control.in @@ -0,0 +1,47 @@ +Source: [% $source %] +Priority: optional +Section: libs +Maintainer: [% $author %] +Standards-Version: [% $standards_version %] +Build-Depends: [% $build_depends %] +Rules-Requires-Root: no + +Package: libfoo1 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (missing ldc) + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. + . + Checks for missing ldconfig in scripts. + +Package: libfish1 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (preinst/rm ldc) + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. + . + Checks for ldconfig in preinst/prerm scripts. + +Package: libuns1 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (unsafe ldc) + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. + . + Checks for unsafe ldconfig usage scripts. + +Package: app +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] (useless ldc) + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. + . + Checks for useless ldconfig usage in scripts. diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.install b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.install new file mode 100644 index 0000000..b1c4ec9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.install @@ -0,0 +1 @@ +usr/lib/libfish* diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.preinst b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.preinst new file mode 100755 index 0000000..3e67b7e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +ldconfig + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.prerm b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.prerm new file mode 100755 index 0000000..3e67b7e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.prerm @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +ldconfig + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.symbols b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.symbols new file mode 100644 index 0000000..2c5a075 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfish1.symbols @@ -0,0 +1,3 @@ +libfish.so.1 libfish1 #MINVER# + e@Base 1.0 + energy@Base 0.9 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.install b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.install new file mode 100644 index 0000000..f3a3a05 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.install @@ -0,0 +1 @@ +usr/lib/libfoo* diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postinst b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postinst new file mode 100755 index 0000000..2615bf9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postinst @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +# No ldconfig +if false ; then true ; fi + +# -- we will remove all debhelper stuff later. +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postrm b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postrm new file mode 100755 index 0000000..9b2f636 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.postrm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if false ; then true ; fi + + +# -- we will remove all debhelper stuff later. +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.symbols b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.symbols new file mode 100644 index 0000000..a1f052b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libfoo1.symbols @@ -0,0 +1,3 @@ +libfoo.so.1 libfoo1 #MINVER# + e@Base 1.0 + energy@Base 0.9 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.install b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.install new file mode 100644 index 0000000..b91d5ff --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.install @@ -0,0 +1 @@ +usr/lib/libuns* diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.postrm b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.postrm new file mode 100755 index 0000000..acc5d15 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.postrm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +ldconfig + + +# -- we will remove all debhelper stuff later. +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.symbols b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.symbols new file mode 100644 index 0000000..d91149f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/libuns1.symbols @@ -0,0 +1,3 @@ +libuns.so.1 libuns1 #MINVER# + e@Base 1.0 + energy@Base 0.9 diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/rules new file mode 100755 index 0000000..b1c71a9 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +%: + dh $@ + +override_dh_builddeb: + for P in $$(dh_listpackages) ; do \ + for S in postinst postrm preinst prerm ; do \ + if [ -f debian/$${P}.$${S} ] ; then \ + cp -af debian/$${P}.$${S} debian/$${P}/DEBIAN/$${S} ; \ + chmod 0755 debian/$${P}/DEBIAN/$${S} ; \ + sed -i '/#DEBHELPER#/ d' debian/$${P}/DEBIAN/$${S} ; \ + fi ; \ + done ; \ + done + # Work around debhelper adding triggers instead of explicit + # ldconfig calls + rm -f debian/libfoo1/DEBIAN/triggers + dh_builddeb diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/fill-values new file mode 100644 index 0000000..2159596 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/fill-values @@ -0,0 +1,5 @@ +Skeleton: upload-native +Testname: shared-libs-ldconfig-scripts +Default-Build-Depends: debhelper (>= 9.20151004~) +Dh-Compat-Level: 9 +Description: Test checks related to ldconfig in scripts diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/Makefile b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/Makefile new file mode 100644 index 0000000..4d3c286 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/Makefile @@ -0,0 +1,22 @@ +CC=gcc +CFLAGS+= -fPIC + +SONAMES:= libfoo.so.1 libfish.so.1 libuns.so.1 +LIBFILES:= $(patsubst %,%.0.1, $(SONAMES)) + +all: $(LIBFILES) + +$(LIBFILES): code.o + $(CC) $(LDFLAGS) -o $@ -shared -Wl,-soname,$(patsubst %.0.1,%,$@) $^ -lm + +clean: + rm -f *.a *.o *.so* + +install: all + install -m 0755 -d $(DESTDIR)/usr/lib + install -m 0644 *.so* $(DESTDIR)/usr/lib + for FILE in $(SONAMES) ; do \ + ln -s $${FILE}.0.1 $(DESTDIR)/usr/lib/$$FILE ; \ + done + +.PHONY: install clean diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/app b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/app new file mode 100755 index 0000000..04f1961 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/app @@ -0,0 +1,2 @@ +#!/bin/sh +echo Hello World diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/code.c b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/code.c new file mode 100644 index 0000000..0ed08e0 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/build-spec/orig/code.c @@ -0,0 +1,15 @@ +#include <stdlib.h> +#include <math.h> + +double e(void (*f)(char *)){ + char tmp[10]; + double x; + f(tmp); + x = atof(tmp); + return exp(x); +} + +double energy(double mass){ + return pow(10.0, 8.0) * pow(3.0, 2.0) * mass; +} + diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/desc b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/desc new file mode 100644 index 0000000..d160b7b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/desc @@ -0,0 +1,2 @@ +Testname: shared-libs-ldconfig-scripts +Check: maintainer-scripts/ldconfig diff --git a/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/hints b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/hints new file mode 100644 index 0000000..bd709fa --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/ldconfig/shared-libs-ldconfig-scripts/eval/hints @@ -0,0 +1,5 @@ +libuns1 (binary): maintscript-calls-ldconfig [postrm] +libfish1 (binary): maintscript-calls-ldconfig [prerm] +libfish1 (binary): maintscript-calls-ldconfig [preinst] +app (binary): maintscript-calls-ldconfig [postrm] +app (binary): maintscript-calls-ldconfig [postinst] diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/maintscript b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/maintscript new file mode 100644 index 0000000..c3dcfac --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/maintscript @@ -0,0 +1 @@ +mv_conffile /etc/foo/old.conf /etc/foo/new.conf 0~ diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postinst new file mode 100755 index 0000000..492f84a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postinst @@ -0,0 +1,255 @@ +#!/bin/sh + +# This file contains a pile of random junk in maintainer scripts that we +# should be checking for in checks/scripts. Don't put bashisms in this file, +# though; those should go into scripts-bashisms. + +set -e + +print "Hit enter to continue" +read foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated and not allowed except the second one. +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +# The first should not trigger an error about a command with a path, but the +# second should. +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac +/usr/bin/baz; echo bar + +# fc-cache shouldn't be called directly, but make sure we don't see it in a +# heredoc. +fc-cache +cat <<EOF +fc-cache +EOF + +# Obsolete suidregister program. +suidregister /usr/bin/foo + +# install-info is now handled through triggers. +install-info --quiet --section Development Development \ + /usr/share/info/foobar.info + +# Packages don't get to modify /etc/ld.so.conf +echo '/usr/local/lib' >> /etc/ld.so.conf +( cat /etc/ld.so.conf ; echo '/usr/local/lib' ) > /etc/ld.so.conf.new +mv /etc/ld.so.conf.new /etc/ld.so.conf + +# Further tests for commands with paths in maintainer scripts. The following +# should not trigger a tag (Bug#536397). +chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2 + +# These, however, should. +true `basename "$0"` `/usr/bin/foo bar` +true `/usr/bin/foo "$0"` + +# This line should not trigger a warning about no dependency on ucf because of +# the || true. (Bug#541372) +ucf -p /etc/sensors3.conf || true + +if false ; then + mknod some thing +fi + +# Calling update alternative --set see #643602 +update-alternatives --set editor /usr/bin/nano + +# false positive +start-stop-daemon--stop --quiet --name foo --startas /usr/bin/foo + +# false positive +start-stop-daemon --quiet --stop --name foo --startas /usr/bin/foo + +# false negative +start-stop-daemon --quiet --start --name foo --startas /usr/bin/foo + +# remove device file +rm /dev/null + +# false positive +rm /dev/shm/test +rm /dev/.hiddenfile + +# adduser system +adduser --system foo +adduser --system foo2 --home /home/foo2 +adduser --system bar --home /var/lib/bar +adduser --home /var/lib/fnord --system fnord +adduser --home /home/fnord2 --system fnord2 + +# other test case for gconftool +/usr/bin/gconftool-2 --makefile-install-rule foo.schema + +# service +service apache2 start + +# adduser through variable +DEVNULL=/dev/null +adduser --system bar1 --home $DEVNULL +adduser --system bar2 --home ${DEVNULL} + +# this is a false positive due to quoting +adduser --system bar2 --home "${DEVNULL}" +adduser --system --ingroup smmta --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Transfer Agent' smmta; + +# false positive +echo "You can use update-alternatives --config runsystem to select" +echo "the runsystem to use." + +# false negative +DIVERSIONS=`env LC_ALL=C /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL="C" /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL='C' /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true + +if [ ! -x /usr/sbin/dpkg-state-override ] || \ + ! dpkg-state-override > /dev/null +then + true; +fi + +# bad +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html/ \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# good +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# true positive +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 + +chown root:root /good +chmod 777 /good +chown -R root:root /bad +chown root:root -R /bad +chown root:root --recursive /bad +chown --recursive root:root /bad +chmod -R 777 /bad +chmod 777 -R /bad +chmod 777 --recursive /bad +chmod --recursive 777 /bad +find /bad -maxdepth 2 -type d -exec chown root:root {} \; # (#895370) +find /bad -maxdepth 2 -type d -exec chmod 777 # (#895370) + +echo /var/lib/dpkg/info/other-package.conffiles +echo /var/lib/dpkg/info/other-package.md5sums +echo /var/lib/dpkg/info/other-package.shlibs +echo /var/lib/dpkg/info/other-package.postinst +echo /var/lib/dpkg/info/other-package.preinst +echo /var/lib/dpkg/info/other-package.list +echo /var/lib/dpkg/triggers/other-package + +getent passwd good || true +getent group good || true +getent passwd good || true # grep /etc/passwd false-positive +getent group good || true # grep /etc/group false-positive +grep bad /etc/passwd || true +grep bad /etc/group || true +grep -E bad /etc/passwd || true +grep -E bad /etc/passwd || true +grep -F bad /etc/group || true +grep -F bad /etc/group || true +# grep /etc/passwd false-positive +# grep /etc/group false-positive + +echo $PIUPARTS_TEST # bad +echo ${PIUPARTS_OBJECTS} +echo ${PIUPARTS_PHASE} +echo ${PIUPARTS_DISTRIBUTION} +echo ${PIUPARTS_DISTRIBUTION_NEXT} +echo ${PIUPARTS_DISTRIBUTION_PREV} +echo $PIUPARTS_IS_AWESOME # good + +#DEBHELPER# + +# Automatically added by dh_dummy/12 +true `/usr/bin/false-positive "$0"` +# End automatically added section diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postrm new file mode 100644 index 0000000..21ce89e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +# we do not set -e + +echo "ok" > /dev/null + +# not allowed +update-alternatives --remove foo + +#DEBHELPER#
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/prerm new file mode 100644 index 0000000..fcbd64e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +# This script should fail a syntax check + +if [ "$1" = configure ] then # oh look - I forgot a ; + echo "Hallo world" +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/rules new file mode 100644 index 0000000..6f66b82 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_installdeb: + dh_installdeb + echo "#DEBHELPER#" >> debian/$(shell dh_listpackages)/DEBIAN/postinst diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/fill-values new file mode 100644 index 0000000..111edec --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: scripts-maintainer-general +Distribution: precise +Description: Check general problems in maintainer scripts diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/desc b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/desc new file mode 100644 index 0000000..1f15359 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/desc @@ -0,0 +1,5 @@ +Testname: scripts-maintainer-general +Profile: ubuntu/main +Check: maintainer-scripts/mknod +See-Also: + Bug#532984 diff --git a/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/hints b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/hints new file mode 100644 index 0000000..0c60c78 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/mknod/scripts-maintainer-general/eval/hints @@ -0,0 +1 @@ +scripts-maintainer-general (binary): mknod-in-maintainer-script [postinst:125] diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/bootmisc.sh b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/bootmisc.sh new file mode 100755 index 0000000..5c73683 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/bootmisc.sh @@ -0,0 +1,59 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: bootmisc +# Required-Start: $remote_fs +# Required-Stop: +# Should-Start: udev +# Default-Start: S +# Default-Stop: +# Short-Description: Miscellaneous things to be done during bootup. +# Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh. +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +[ "$DELAYLOGIN" ] || DELAYLOGIN=yes +. /lib/init/vars.sh + +do_start () { + # + # If login delaying is enabled then create the flag file + # which prevents logins before startup is complete + # + case "$DELAYLOGIN" in + Y*|y*) + echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin + ;; + esac + + # Create /var/run/utmp so we can login. + : > /var/run/utmp + if grep -q ^utmp: /etc/group + then + chmod 664 /var/run/utmp + chgrp utmp /var/run/utmp + fi + + # Remove bootclean's flag files. + # Don't run bootclean again after this! + rm -f /tmp/.clean /run/.clean /run/lock/.clean + rm -f /tmp/.tmpfs /run/.tmpfs /run/lock/.tmpfs +} + +case "$1" in + start|"") + do_start + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop|status) + # No-op + ;; + *) + echo "Usage: bootmisc.sh [start|stop]" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/init b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/init new file mode 100644 index 0000000..96f6ed2 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/init @@ -0,0 +1,153 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: systemd-general +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: S 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Example Lintian initscript +# Description: This file should be used to construct scripts to be +# placed in /etc/init.d. +### END INIT INFO + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Description of the service" +NAME=daemonexecutablename +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="--options args" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/install b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/install new file mode 100644 index 0000000..eb4680b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/install @@ -0,0 +1,3 @@ +debian/systemd-general.test.service etc/systemd/system/ +debian/systemd-general.test.service usr/lib/systemd/system/ +debian/test.conf etc/tmpfiles.d/ diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/links b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/links new file mode 100644 index 0000000..c022cff --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/links @@ -0,0 +1 @@ +/dev/null /lib/systemd/system/masked.service diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/postrm new file mode 100644 index 0000000..6e5813a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/postrm @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ] && which systemctl >/dev/null 2>&1; then + systemctl || true +fi + +#DEBHELPER# + diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/rules new file mode 100644 index 0000000..68b3e30 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/rules @@ -0,0 +1,30 @@ +#!/usr/bin/make -f + +ETC_DIR=debian/$(shell dh_listpackages)/etc/ +INITD_DIR=$(ETC_DIR)/init.d +SYSD_DIR=$(ETC_DIR)/systemd/system + +%: + dh $@ + +override_dh_install: + dh_install + install -m 0755 -d $(INITD_DIR) $(SYSD_DIR) + mkfifo $(INITD_DIR)/fifo-pipe-as-init + mkfifo $(SYSD_DIR)/fifo-pipe-as-init.service + install -m 0755 debian/bootmisc.sh $(INITD_DIR) + install -m 0755 debian/systemd-general.masked.init $(INITD_DIR)/masked + touch $(INITD_DIR)/README + +override_dh_fixperms: + dh_fixperms + chmod -x $(INITD_DIR)/README + +override_dh_installinit: + dh_installinit + dh_installinit --name systemd-aliasd + dh_installinit --name sourced.sh + +override_dh_installsystemd: + dh_installsystemd + dh_installsystemd --name sourced diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.masked.init b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.masked.init new file mode 100644 index 0000000..b884a82 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.masked.init @@ -0,0 +1,22 @@ +#!/bin/sh +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +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 +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# 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 +# file. To get other behaviors, implement +# do_start(), do_stop() or other functions to +# override the defaults in /lib/init/init-d-script. +### END INIT INFO + +DESC="Description of the service" +DAEMON=/usr/sbin/daemonexecutablename diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.service b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.service new file mode 100644 index 0000000..f3775af --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.service @@ -0,0 +1,9 @@ +[Unit] +After=network.target +Documentation=man:sourced(1) + +[Service] +ExecStart=/usr/bin/test + +[Install] +WantedBy=sleep.target diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.sh.init b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.sh.init new file mode 100644 index 0000000..6657c99 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.sourced.sh.init @@ -0,0 +1,22 @@ +#!/bin/sh +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script +fi +### BEGIN INIT INFO +# Provides: sourced +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# 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 +# file. To get other behaviors, implement +# do_start(), do_stop() or other functions to +# override the defaults in /lib/init/init-d-script. +### END INIT INFO + +DESC="Description of the service" +DAEMON=/usr/sbin/daemonexecutablename diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init new file mode 100644 index 0000000..95e791c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.systemd-aliasd.init @@ -0,0 +1,152 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: systemd-aliasd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Example Lintian initscript +# Description: This file should be used to construct scripts to be +# placed in /etc/init.d. +### END INIT INFO + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Description of the service" +NAME=daemonexecutablename +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="--options args" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +. /lib/lsb/init-functionsh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.test.service b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.test.service new file mode 100644 index 0000000..a456a3d --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/systemd-general.test.service @@ -0,0 +1,13 @@ +[Unit] +After=network.target \ +syslog.target +BindTo=foo + +[Service] +ExecStartPre = /bin/true +ExecStart=/usr/bin/test + +[Install] +WantedBy=multi-user.target unusual.target +Alias=systemd-aliasd.service +Alias=anothertest diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/test.conf b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/test.conf new file mode 100644 index 0000000..b0c4604 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/debian/test.conf @@ -0,0 +1,2 @@ +# See tmpfiles.d(5) for details +d /var/run/bacula 2775 bacula bacula - diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/fill-values new file mode 100644 index 0000000..eee4826 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/build-spec/fill-values @@ -0,0 +1,3 @@ +Skeleton: upload-native +Testname: systemd-general +Description: General systemd tests diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/desc b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/desc new file mode 100644 index 0000000..ff87425 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/desc @@ -0,0 +1,2 @@ +Testname: systemd-general +Check: maintainer-scripts/systemctl diff --git a/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/hints b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/hints new file mode 100644 index 0000000..ad37c1c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/systemctl/systemd-general/eval/hints @@ -0,0 +1 @@ +systemd-general (binary): maintainer-script-calls-systemctl [postrm:6] diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/changelog.in b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/changelog.in new file mode 100644 index 0000000..a12fc8c --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/changelog.in @@ -0,0 +1,57 @@ +maintainer-scripts ([% $version %]) [% $distribution %]; urgency=low + + * Doing an upload for QA but I fail to give it a correct version number, + have some uploaders, and also fail to mention it... Bad me ;) + + -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl> Sun, 18 Apr 2004 02:05:29 +0200 + +maintainer-scripts (6.1) unstable; urgency=low + + * I made this entry on my local PC, oops ;) + + -- Jeroen van Wolffelaar <jeroen@mordor> Sat, 21 Feb 2004 18:29:37 +0100 + +maintainer-scripts (6) unstable; urgency=low + + * added ldconfig calls to postrm to check test the postrm tests + from shared-libs + + -- Frank Lichtenheld <djpig@debian.org> Sat, 21 Feb 2004 18:29:36 +0100 + +maintainer-scripts (5) unstable; urgency=low + + * added bash style arrays to postinst, this one is for you Torsten (-: + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 30 Mar 2001 23:27:06 -0800 + +maintainer-scripts (4) unstable; urgency=low + + * added a here document to the prerm, along with two more bashisms + * made postrm a bash script to check that bash scripts are not searched + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Mon, 26 Feb 2001 13:02:57 -0800 + +maintainer-scripts (3) unstable; urgency=low + + * Added check for '.' called as '. foo || bar', lintian 1.11.15 failed this + thinking the '||' was a argument. + * also added an invalid call to '. foo bar' + * postinst now has a space between the #! and /bin/sh to test the interpreter + checking code. + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Tue, 9 Jan 2001 23:06:25 -0800 + +maintainer-scripts (2) unstable; urgency=low + + * Fix location of changelog. + * prerm and postrm do 'update-alternatives --remove'; should only complain + about postrm. + + -- Colin Watson <cjw44@flatline.org.uk> Fri, 29 Dec 2000 06:01:24 +0000 + +maintainer-scripts (1) unstable; urgency=low + + * Initial version + * postinst and prerm set the usr/doc symlink + + -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 16 Nov 2000 09:11:40 -0800 diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/config b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/config new file mode 100644 index 0000000..29abeba --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/config @@ -0,0 +1,3 @@ +#!/usr/bin/python + +# I use python, but that's not what I'm supposed to be allowed to use diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/control.in b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/control.in new file mode 100644 index 0000000..63dd2db --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/control.in @@ -0,0 +1,18 @@ +Source: maintainer-scripts +Section: misc +Priority: optional +Maintainer: QA group <packages@qa.debian.org> +Uploaders: Anyone but Jeroen <jeroen@wolffelaar.nl> +Build-Depends: [% $build_depends %] +Standards-Version: 3.1.1 +Rules-Requires-Root: binary-targets +XS-Dm-Upload-Allowed: Yes + +Package: maintainer-scripts +Architecture: [% $package_architecture %] +Depends: test +Description: test lintian's maintainer script checks + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postinst new file mode 100644 index 0000000..e56ed3b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postinst @@ -0,0 +1,181 @@ +#! /bin/sh -e + +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a -d /usr/share/doc/maintainer-scripts ]; then + ln -sf ../share/doc/maintainer-scripts /usr/doc/maintainer-scripts + fi +fi + +# valid +. /usr/share/lintian/shell || exit 0 +. /usr/share/lintian/shell >/dev/null +. /usr/share/lintian/shell 2>/dev/null +. /usr/share/lintian/shell </dev/null +. "$(dirname $0)/shell" ; bar +# invalid +. /usr/share/lintian/shell foo +. "$(dirname $0)/shell" bar + +print "Hit enter to continue" +read + +H[0]='this is a string' +echo ${H[0]} +echo "Index 0's length is ${#H[0]}" +echo "All of the array is: ${H[@]}" + +install-info /usr/share/info/foo \ + --quiet \ # make it so + --section foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +$FOO=bar +update-rc.d foo defaults >/dev/null +update-rc.d $FOO defaults +update-rc.d foo remove + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +FOO="/tmp/false.positive.XXXXXX" +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# This too is a heredoc. +some-program > /etc/config-file <<'EOF' +echo "All of the array is: ${H[@]}" +EOF + +# But this isn't. +cat '<<EOF' +echo "All of the array is: ${H[@]}" +EOF + +# This is a heredoc +cat <<-EOF +echo "All of the array is ${H[@]}" +EOF + +# As is this +cat <<';' +echo "All of the array is ${H[@]}" +; + +# and this +cat <<foo +echo "All of the array is ${H[@]}" +foobar +echo $HOSTNAME +foo + +# and again +cat <<\bar +echo "All of the array is ${H[@]}" +bar + +# yet another +cat <<"x++" +echo "All of the array is ${H[@]}" +x++ + +# Recognize single quotes even if they start at the beginning of a line. +echo not a bashism \ +'/{ptex,tex}/{amstex,plain,generic,}' + +# More bashisms. +echo -e 'foo\n' +echo "${!foo}" +cat $(\< file) +select foo in a b ; do echo $foo ; done +cnt=$((cnt + 1)) +if false ; then + exec -l /bin/sh + exec -c /bin/sh + exec -a foo /bin/sh +fi +let cnt++ +if test -a /etc/default ; then + echo "$RANDOM|stuff" +fi + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac + +/usr/bin/baz; echo bar + +# Some comment checking +# This should flag $RANDOM +test $# -gt 2 && echo $RANDOM +# But these shouldn't +test 1=1 # echo $RANDOM +(test 1=1)# echo $RANDOM +test 1=1;# echo $RANDOM +backgroundtask &#echo $RA diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postrm new file mode 100644 index 0000000..c0aaf19 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/postrm @@ -0,0 +1,47 @@ +#!/bin/bash +#set -e + +update-alternatives --remove dummy /usr/bin/dummy-alternative + +# Normally read in a maintainer script is not kosher, but here we're going +# to do it only if debconf doesn't exist. +if ! test -f /usr/share/debconf/confmodule ; then + echo "Hit enter" + read +fi + +# neither of the following should be detected as postrm-unsafe-ldconfig +# intended, without quotes + if [ "$1" = remove ]; then + ldconfig + fi +# reversed, many whitespace +if [ 'remove' = "$1" ] +then + + ldconfig +fi + +[ "remove" ="$1" ] && ldconfig + +update-rc.d bar remove + +# Shouldn't provoke an error despite no invoke-rc.d. +echo "/etc/init.d/package stop to stop something" + +# Shouldn't require a ucf dependency. Unfortunately, right now that's +# just because postrm isn't checked, not because we ensure that the +# invocation is conditional. +if which ucf >/dev/null; then + ucf --purge /etc/foo.conf +fi + +# This isn't allowed. +rm /tmp/foo /dev/device +rm /dev/device1 + +# But this is okay. +rm /tmp/foo > /dev/null + +# Not allowed here even with remove. +install-sgmlcatalog --remove package diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/preinst b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/preinst new file mode 100644 index 0000000..6058978 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/preinst @@ -0,0 +1,18 @@ +#!/bin/sh + +update-rc.d foo remove +update-rc.d bar defaults + +# Obsolete dpkg assertions. +dpkg --assert-support-predepends || exit 1 +dpkg --assert-working-epoch || exit 1 +dpkg --assert-long-filenames || exit 1 +dpkg --assert-multi-conrep || exit 1 + +/bin/grep -E --mmap "^Package: foo$" /var/lib/dpkg/status + +# continuation lines +update-alternatives --install /usr/bin/fakeroot fakeroot \ + /usr/bin/fakeroot-ng 5 \ + --slave /usr/share/man/man1/fakeroot.1.gz \ + fakeroot.1.gz /usr/share/man/man1/fakeroot-ng.1.gz diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/prerm new file mode 100644 index 0000000..076ecaf --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/prerm @@ -0,0 +1,188 @@ +#!/bin/sh + +if [ "$1" != "upgrade" ]; then + update-alternatives --remove dummy /usr/bin/dummy-alternative +fi + +if ([ "$1" = "upgrade" ] || [ "$1" = "remove" ]) && [ -L /usr/doc/maintainer-scripts ]; the +n + rm -f /usr/doc/maintainer-scripts +fi + +cat <<EOF +This is all really bad bash specific code!!! +read +source /bar/baz/bat foo +EOF + +# ok, back to checking +if [ "$2" == "purge" ]; then + rm -r /bar/baz +fi + +function foo( ) { + # but not here: local + local bar + echo "foo" &>/dev/null +} + +source $FOO + +trap "echo hi" EXIT HUP 3 + +if [[ "$2" = "purge" ]]; then + kill -HUP $$ +fi + +#this is ok though +if test -n $(echo foo | perl -pe 's/[[:space:]]//go'); then + echo 1 +fi + +update-rc.d foo remove + +# More false positives for bashism checks. None of these are errors. +echo "$line" | grep -q '{fonts/map,}/{\$progname,pdftex,dvips,}//' +echo "$line" | grep -q "${fonts},${foo}" +echo '$[1+2]' +printf "foo |& bar" +perl -e "print q( kill -HUP $? )" + +# Still catch disallowed expansions in double-quotes, though. +echo "${line:3:1}" + +# The wrong way to run an init script (no invoke-rc.d). +/etc/init.d/package stop + +# This is the only install-sgmlcatalog call that's allowed. +install-sgmlcatalog --quiet --remove package + +# More bashisms checks + +read -x foo +read -x +read -r foo +read foo +read + +echo "a\\b" +echo 'a\nb' + +echo "${UID}" +echo "$EUID" +echo "$SHLVL" +echo "$DIRSTACK" +echo "$SECONDS" +echo "$BASH" +echo "$BASH_FOO" +echo "$SHELLOPTS" +echo "$PIPESTATUS" + +bar="$(cut '-d|' -f2 <<< "$foo")" + +VAR=1 +VAR+=a + +echos() { + echo -n -e "bar" + echo -e -n "bar" + echo -en "bar" + echo -ne "bar" + echo "bar" + echo "echo -e foo" +} + +ech.os() { + echo foo >& 2 + echo foo >&bar + echo foo >& bar +} + +echoes() { + echo "abc\nxyz" + echo 'xyz\rabc' + echo foo\cbar + + echo -e "abc\nxyz" + echo -net 'xyz\rabc' + echo -e foo\cbar +} + +foobar.() { + suspend x + suspended x + caller x + complete x + compgen x + declare -a foo +} + +.foobar() { + typeset -x bar + disown 1 + builtin foo + set -B + alias -p + unalias -a +} + +IFS="()" + +ulimit +shopt +type -v bar +time ls +dirs +diff <(tac a) <(tac b) + +pushd + +local foo=bar +local -x foo + +popd + +readonly -f + +echo bar > /dev/tcp +export x +export -x x +export -p x + +sh -x +sh -D +sh --foo +sh +O + +# Brace expansion checks +echo {a,b} +echo {abc},{bcd} + +foobar() +{ + # This is a function +} + + foo.bar() +( + # This is a function with a bad name +) + +foobar@() +{ + # As is this +} + +# This is ok +read -r foo +# but these aren't +read -r +read -p "Would you like to restart the service?" foo bar +read --fish + +set -e + +source "$BAR" +source '$BAR' +source ~/bar +source a diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/rules new file mode 100755 index 0000000..de4161e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/rules @@ -0,0 +1,36 @@ +#!/usr/bin/make -f + +build-arch: + +build-indep: + +build: build-arch build-indep + +binary-arch: + +binary-indep: + install -d debian/tmp/DEBIAN + install -m 0755 debian/config debian/tmp/DEBIAN + install -m 0755 debian/preinst debian/tmp/DEBIAN + install -m 0755 debian/postinst debian/tmp/DEBIAN + install -m 0755 debian/prerm debian/tmp/DEBIAN + install -m 0755 debian/postrm debian/tmp/DEBIAN + install -m 0644 debian/triggers debian/tmp/DEBIAN + install -d debian/tmp/usr/share/doc/maintainer-scripts + install -m 0644 debian/changelog \ + debian/tmp/usr/share/doc/maintainer-scripts/changelog + gzip -n -9 debian/tmp/usr/share/doc/maintainer-scripts/changelog + dpkg-gencontrol -isp + dpkg --build debian/tmp .. + +binary: binary-arch binary-indep + +# Make sure we see dh_clean even in a rule clean depends on. Not the point of +# this test suite, but a convenient place to put it. +clean: clean1 clean2 clean3 +clean1: +clean2: + dh_clean +clean3: + +.PHONY: build-arch build-indep build binary-arch binary-indep binary clean diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/triggers b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/triggers new file mode 100644 index 0000000..f627094 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/triggers @@ -0,0 +1,4 @@ +# Example triggers file +activate foo + +interest bar diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/watch b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/watch new file mode 100644 index 0000000..430eea3 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/debian/watch @@ -0,0 +1,11 @@ +# A whitespace is fine for uscan: + version=5 + +# Following line should not be matched: +#opts=uversionmangle=s/$/+debian/,dversionmangle=s/foo/bar/ \ +# Following one is incorrect, there's a missing backslash at the end +opts=uversionmangle=s/$/+dfsg/,dversionmangle=s/foo/bar/ + +# 'active' is useless here, but it works anyway +options=active \ +http://domain.tld/foo-(.+)\.tar\.gz
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/fill-values new file mode 100644 index 0000000..c281e87 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-non-native +Testname: legacy-maintainer-scripts +Source: maintainer-scripts +Version: 7+dfsg-0.1 +Description: Legacy test "maintainer-scripts" +Extra-Build-Depends: dash (>= 0.5.10.2) diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/desc b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/desc new file mode 100644 index 0000000..047d119 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/desc @@ -0,0 +1,2 @@ +Testname: legacy-maintainer-scripts +Check: maintainer-scripts/temporary-files diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/hints b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/hints new file mode 100644 index 0000000..7899e4f --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/hints @@ -0,0 +1,8 @@ +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /var/tmp [postinst:53] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /var/tmp [postinst:43] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postrm:44] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postrm:40] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:52] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:51] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:44] +maintainer-scripts (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:42] diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/post-test b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/post-test new file mode 100644 index 0000000..faeef0b --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/legacy-maintainer-scripts/eval/post-test @@ -0,0 +1 @@ +s/\(current is ([0-9]+\.)+[0-9]\)/(current is CURRENT)/ diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/maintscript b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/maintscript new file mode 100644 index 0000000..c3dcfac --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/maintscript @@ -0,0 +1 @@ +mv_conffile /etc/foo/old.conf /etc/foo/new.conf 0~ diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postinst b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postinst new file mode 100755 index 0000000..492f84a --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postinst @@ -0,0 +1,255 @@ +#!/bin/sh + +# This file contains a pile of random junk in maintainer scripts that we +# should be checking for in checks/scripts. Don't put bashisms in this file, +# though; those should go into scripts-bashisms. + +set -e + +print "Hit enter to continue" +read foo + +echo Please use update-rc.d or invoke-rc.d to set up blah blah. + +chown root.root /usr/share/doc/maintainer-scripts/changelog +chown root:root /usr/share/doc/maintainer-scripts/changelog + +# valid +FOO=/tmp +FOO=/var/tmp +: ${FOO:=/tmp} +FOO=`mktemp /tmp/scripts.XXXXXX` +rm "$FOO" +FOO=`tempfile -n/tmp/scripts.tmp` +mkdir /var/tmp/scripts +# invalid +echo foo >>/tmp/scripts.tmp +rm /tmp/scripts.tmp +rmdir /var/tmp/scripts + +# invalid, maintainer-script-hides-init-failure +invoke-rc.d foo start || exit 0 + +# The right way to invoke an rc script +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d package start +else + /etc/init.d/package start +fi + +# Example ucf invocation. +ucf /usr/share/foo/configuration /etc/foo.conf + +# Calling gconftool directly. +gconftool-2 --makefile-install-rule foo.schema + +# Calling gconf-schemas with no dependency. +gconf-schemas --register foo.schema + +# Calling update-xmlcatalog with no dependency. +update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \ + --package maintainer-scripts --root + +# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old +# recipe from the dpkg wiki that should be replaced with dpkg-query. +sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \ + /var/lib/dpkg/status + +# Don't modify these files. +echo 'broken 6714/tcp' >> /etc/services +cp /nonexistent /etc/protocols +mv /usr/share/doc/rpc /etc/rpc + +# But this is okay. +cp /etc/protocols /etc/protocols.new + +# This is also wrong. +echo 'broken' > /etc/inetd.conf +cp /etc/inetd.conf.new /etc/inetd.conf + +# But this is fine. +cp /etc/inetd.conf /srv/chroot/etc/inetd.conf + +# Deprecated and not allowed except the second one. +install-sgmlcatalog --install package +install-sgmlcatalog --remove package + +# Calling start-stop-daemon directly in an init script. +start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo + +# But stopping it is fine -- we may be working around something else. +start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo + +# Deprecated chown use with flags. +chown -R root.root /usr/share/doc/maintainer-scripts + +# The first should not trigger an error about a command with a path, but the +# second should. +case $mainscript in + /usr/bin/foo) foobarbaz;; +esac +/usr/bin/baz; echo bar + +# fc-cache shouldn't be called directly, but make sure we don't see it in a +# heredoc. +fc-cache +cat <<EOF +fc-cache +EOF + +# Obsolete suidregister program. +suidregister /usr/bin/foo + +# install-info is now handled through triggers. +install-info --quiet --section Development Development \ + /usr/share/info/foobar.info + +# Packages don't get to modify /etc/ld.so.conf +echo '/usr/local/lib' >> /etc/ld.so.conf +( cat /etc/ld.so.conf ; echo '/usr/local/lib' ) > /etc/ld.so.conf.new +mv /etc/ld.so.conf.new /etc/ld.so.conf + +# Further tests for commands with paths in maintainer scripts. The following +# should not trigger a tag (Bug#536397). +chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2 + +# These, however, should. +true `basename "$0"` `/usr/bin/foo bar` +true `/usr/bin/foo "$0"` + +# This line should not trigger a warning about no dependency on ucf because of +# the || true. (Bug#541372) +ucf -p /etc/sensors3.conf || true + +if false ; then + mknod some thing +fi + +# Calling update alternative --set see #643602 +update-alternatives --set editor /usr/bin/nano + +# false positive +start-stop-daemon--stop --quiet --name foo --startas /usr/bin/foo + +# false positive +start-stop-daemon --quiet --stop --name foo --startas /usr/bin/foo + +# false negative +start-stop-daemon --quiet --start --name foo --startas /usr/bin/foo + +# remove device file +rm /dev/null + +# false positive +rm /dev/shm/test +rm /dev/.hiddenfile + +# adduser system +adduser --system foo +adduser --system foo2 --home /home/foo2 +adduser --system bar --home /var/lib/bar +adduser --home /var/lib/fnord --system fnord +adduser --home /home/fnord2 --system fnord2 + +# other test case for gconftool +/usr/bin/gconftool-2 --makefile-install-rule foo.schema + +# service +service apache2 start + +# adduser through variable +DEVNULL=/dev/null +adduser --system bar1 --home $DEVNULL +adduser --system bar2 --home ${DEVNULL} + +# this is a false positive due to quoting +adduser --system bar2 --home "${DEVNULL}" +adduser --system --ingroup smmta --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Transfer Agent' smmta; + +# false positive +echo "You can use update-alternatives --config runsystem to select" +echo "the runsystem to use." + +# false negative +DIVERSIONS=`env LC_ALL=C /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL="C" /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true +DIVERSIONS=`env LC_ALL='C' /usr/sbin/dpkg-divert --list | grep -E 'by amule(-utils)?$'` || true + +if [ ! -x /usr/sbin/dpkg-state-override ] || \ + ! dpkg-state-override > /dev/null +then + true; +fi + +# bad +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html/ \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# good +dpkg-maintscript-helper symlink_to_dir \ + /usr/share/autoconf-archive/html \ + ../../autoconf-archive/html \ + 20111221-2~ -- "$@" + +# true positive +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 + +chown root:root /good +chmod 777 /good +chown -R root:root /bad +chown root:root -R /bad +chown root:root --recursive /bad +chown --recursive root:root /bad +chmod -R 777 /bad +chmod 777 -R /bad +chmod 777 --recursive /bad +chmod --recursive 777 /bad +find /bad -maxdepth 2 -type d -exec chown root:root {} \; # (#895370) +find /bad -maxdepth 2 -type d -exec chmod 777 # (#895370) + +echo /var/lib/dpkg/info/other-package.conffiles +echo /var/lib/dpkg/info/other-package.md5sums +echo /var/lib/dpkg/info/other-package.shlibs +echo /var/lib/dpkg/info/other-package.postinst +echo /var/lib/dpkg/info/other-package.preinst +echo /var/lib/dpkg/info/other-package.list +echo /var/lib/dpkg/triggers/other-package + +getent passwd good || true +getent group good || true +getent passwd good || true # grep /etc/passwd false-positive +getent group good || true # grep /etc/group false-positive +grep bad /etc/passwd || true +grep bad /etc/group || true +grep -E bad /etc/passwd || true +grep -E bad /etc/passwd || true +grep -F bad /etc/group || true +grep -F bad /etc/group || true +# grep /etc/passwd false-positive +# grep /etc/group false-positive + +echo $PIUPARTS_TEST # bad +echo ${PIUPARTS_OBJECTS} +echo ${PIUPARTS_PHASE} +echo ${PIUPARTS_DISTRIBUTION} +echo ${PIUPARTS_DISTRIBUTION_NEXT} +echo ${PIUPARTS_DISTRIBUTION_PREV} +echo $PIUPARTS_IS_AWESOME # good + +#DEBHELPER# + +# Automatically added by dh_dummy/12 +true `/usr/bin/false-positive "$0"` +# End automatically added section diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postrm b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postrm new file mode 100644 index 0000000..21ce89e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +# we do not set -e + +echo "ok" > /dev/null + +# not allowed +update-alternatives --remove foo + +#DEBHELPER#
\ No newline at end of file diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/prerm b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/prerm new file mode 100644 index 0000000..fcbd64e --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +# This script should fail a syntax check + +if [ "$1" = configure ] then # oh look - I forgot a ; + echo "Hallo world" +fi + +#DEBHELPER# diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/rules b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/rules new file mode 100644 index 0000000..6f66b82 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_installdeb: + dh_installdeb + echo "#DEBHELPER#" >> debian/$(shell dh_listpackages)/DEBIAN/postinst diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/fill-values b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/fill-values new file mode 100644 index 0000000..111edec --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/build-spec/fill-values @@ -0,0 +1,4 @@ +Skeleton: upload-native +Testname: scripts-maintainer-general +Distribution: precise +Description: Check general problems in maintainer scripts diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/desc b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/desc new file mode 100644 index 0000000..9f14684 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/desc @@ -0,0 +1,5 @@ +Testname: scripts-maintainer-general +Profile: ubuntu/main +Check: maintainer-scripts/temporary-files +See-Also: + Bug#532984 diff --git a/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/hints b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/hints new file mode 100644 index 0000000..4796720 --- /dev/null +++ b/t/recipes/checks/maintainer-scripts/temporary-files/scripts-maintainer-general/eval/hints @@ -0,0 +1,6 @@ +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /var/tmp [postinst:28] +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /var/tmp [postinst:19] +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:27] +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:26] +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:20] +scripts-maintainer-general (binary): possibly-insecure-handling-of-tmp-files-in-maintainer-script /tmp [postinst:18] |