Package: lintian Version: 2.5.49 Followup-For: Bug #743599 Hi Luca,
I also ran into this issue when packaging git-bz (http://fishsoup.net/software/git-bz/). When using dh_python2 (in my case with no specific python version in debian/control) the package ends up depending on pyhton:any, and lintian does not know that python:any is OK as a dependency for scripts using python2 in the shebang line. Your patch fixes this but AFAICS makes lintian emit an unnecessary warning: W: scripts: unusual-interpreter usr/bin/script_name #!python2 Maybe this is a better fix: diff --git a/data/scripts/interpreters b/data/scripts/interpreters index 9b02c15..9955e6d 100644 --- a/data/scripts/interpreters +++ b/data/scripts/interpreters @@ -72,6 +72,7 @@ plackup => /usr/bin, libplack-perl procmail => /usr/bin pypy => /usr/bin python => /usr/bin, python:any | python-minimal:any +python2 => /usr/bin, python:any | python-minimal:any pforth => /usr/bin racket => /usr/bin rake => /usr/bin The rationale is that even if there is a 2 in the interpreter name, it requires _unversioned_ dependencies. See the attached patches to follow my analysis of the problem. Thanks, Antonio -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (900, 'unstable'), (500, 'unstable-debug') Architecture: amd64 (x86_64) Kernel: Linux 4.8.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=it_IT.utf8, LC_CTYPE=it_IT.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Init: systemd (via /run/systemd/system) Versions of packages lintian depends on: ii binutils 2.27.51.20161105-2 ii bzip2 1.0.6-8 ii diffstat 1.61-1 ii file 1:5.29-1 ii gettext 0.19.8.1-1 ii intltool-debian 0.35.0+20060710.4 ii libapt-pkg-perl 0.1.30 ii libarchive-zip-perl 1.59-1 ii libclass-accessor-perl 0.34-1 ii libclone-perl 0.38-2+b1 ii libdpkg-perl 1.18.13 ii libemail-valid-perl 1.202-1 ii libfile-basedir-perl 0.07-1 ii libipc-run-perl 0.94-1 ii liblist-moreutils-perl 0.416-1+b1 ii libparse-debianchangelog-perl 1.2.0-11 ii libperl5.22 [libdigest-sha-perl] 5.22.2-5 ii libperl5.24 [libdigest-sha-perl] 5.24.1~rc3-3 ii libtext-levenshtein-perl 0.13-1 ii libtimedate-perl 2.3000-2 ii liburi-perl 1.71-1 ii libyaml-libyaml-perl 0.63-1+b1 ii man-db 2.7.5-1 ii patchutils 0.3.4-2 ii perl 5.24.1~rc3-3 ii t1utils 1.39-2 ii xz-utils 5.2.2-1.2 Versions of packages lintian recommends: ii dpkg 1.18.13 ii libautodie-perl 2.29-2 ii libperlio-gzip-perl 0.19-1+b2 ii perl 5.24.1~rc3-3 ii perl-modules-5.22 [libautodie-perl] 5.22.2-5 ii perl-modules-5.24 [libautodie-perl] 5.24.1~rc3-3 Versions of packages lintian suggests: pn binutils-multiarch <none> ii dpkg-dev 1.18.13 ii libhtml-parser-perl 3.72-2+b1 ii libtext-template-perl 1.46-1 -- no debconf information -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?
>From 62df15a0afe5df4d30c0309cc7bf4e449250b2a7 Mon Sep 17 00:00:00 2001 From: Antonio Ospite <a...@ao2.it> Date: Mon, 7 Nov 2016 15:51:37 +0100 Subject: [PATCH 1/3] t/tests/legacy-scripts: rename py2foo to py2.X foo The new name reflects better the interpreter used in the script, which is python2.2. A new py2foo script using python2 as interpreter will be added in a subsequent commit. This will make it easier to differentiate the two cases and handle them both. --- t/tests/legacy-scripts/debian/debian/rules | 4 ++-- t/tests/legacy-scripts/tags | 6 +++--- t/tests/legacy-scripts/upstream/{py2foo => py2.Xfoo} | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename t/tests/legacy-scripts/upstream/{py2foo => py2.Xfoo} (100%) diff --git a/t/tests/legacy-scripts/debian/debian/rules b/t/tests/legacy-scripts/debian/debian/rules index 25b6f9e..01ee039 100755 --- a/t/tests/legacy-scripts/debian/debian/rules +++ b/t/tests/legacy-scripts/debian/debian/rules @@ -30,9 +30,9 @@ binary-indep: install -m 755 fish-foo $(tmp)/etc/fish.d/ install -m 755 jruby-broken $(tmp)/usr/bin/ install -m 755 pyfoo $(tmp)/usr/bin/ - install -m 755 py2foo $(tmp)/usr/bin/ + install -m 755 py2.Xfoo $(tmp)/usr/bin/ # This uses "env" and should trigger script-in-usr-share-doc - install -m 755 py2foo $(tmp)/usr/share/doc/scripts/ + install -m 755 py2.Xfoo $(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 diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags index 0436902..11ffd30 100644 --- a/t/tests/legacy-scripts/tags +++ b/t/tests/legacy-scripts/tags @@ -16,7 +16,7 @@ E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo) E: scripts: package-installs-python-bytecode usr/lib/python2.3/site-packages/test.pyc E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/php5foo E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/phpfoo -E: scripts: python-script-but-no-python-dep usr/bin/py2foo +E: scripts: python-script-but-no-python-dep usr/bin/py2.Xfoo E: scripts: python-script-but-no-python-dep usr/bin/pyfoo E: scripts: shell-script-fails-syntax-check usr/bin/sh-broken E: scripts: wrong-path-for-interpreter usr/bin/lefty-foo (#!/usr/local/bin/lefty != /usr/bin/lefty) @@ -32,7 +32,7 @@ I: scripts: init.d-script-does-not-implement-optional-option etc/init.d/skeleton I: scripts: init.d-script-does-not-provide-itself etc/init.d/lsb-broken I: scripts: init.d-script-missing-lsb-short-description etc/init.d/lsb-other I: scripts: no-md5sums-control-file -I: scripts: script-in-usr-share-doc usr/share/doc/scripts/py2foo +I: scripts: script-in-usr-share-doc usr/share/doc/scripts/py2.Xfoo I: scripts: script-in-usr-share-doc usr/share/doc/scripts/rubyfoo W: scripts source: ancient-standards-version 3.2.1 (current is CURRENT) W: scripts source: binary-arch-rules-but-pkg-is-arch-indep @@ -55,7 +55,7 @@ W: scripts: binary-without-manpage usr/bin/perl-bizarre-1 W: scripts: binary-without-manpage usr/bin/perl-bizarre-2 W: scripts: binary-without-manpage usr/bin/perl-bizarre-3 W: scripts: binary-without-manpage usr/bin/perlfoo -W: scripts: binary-without-manpage usr/bin/py2foo +W: scripts: binary-without-manpage usr/bin/py2.Xfoo W: scripts: binary-without-manpage usr/bin/pyfoo W: scripts: binary-without-manpage usr/bin/rubyfoo W: scripts: binary-without-manpage usr/bin/sh-broken diff --git a/t/tests/legacy-scripts/upstream/py2foo b/t/tests/legacy-scripts/upstream/py2.Xfoo similarity index 100% rename from t/tests/legacy-scripts/upstream/py2foo rename to t/tests/legacy-scripts/upstream/py2.Xfoo -- 2.10.2
>From 2848a0a790bdcd1d1f0ec5b3ae63b9d276a72afc Mon Sep 17 00:00:00 2001 From: Antonio Ospite <a...@ao2.it> Date: Mon, 7 Nov 2016 16:27:55 +0100 Subject: [PATCH 2/3] t/tests/legacy-scripts: add a test script for when the interpreter is python2 This allows to analyze separately the cases of when the interpreter is python, python2, or pyhton2.X. --- t/tests/legacy-scripts/debian/debian/rules | 3 +++ t/tests/legacy-scripts/tags | 3 +++ t/tests/legacy-scripts/upstream/py2foo | 4 ++++ 3 files changed, 10 insertions(+) create mode 100755 t/tests/legacy-scripts/upstream/py2foo diff --git a/t/tests/legacy-scripts/debian/debian/rules b/t/tests/legacy-scripts/debian/debian/rules index 01ee039..11c3837 100755 --- a/t/tests/legacy-scripts/debian/debian/rules +++ b/t/tests/legacy-scripts/debian/debian/rules @@ -33,6 +33,9 @@ binary-indep: install -m 755 py2.Xfoo $(tmp)/usr/bin/ # This uses "env" and should trigger script-in-usr-share-doc install -m 755 py2.Xfoo $(tmp)/usr/share/doc/scripts/ + install -m 755 py2foo $(tmp)/usr/bin/ +# This uses "env" and should trigger script-in-usr-share-doc + install -m 755 py2foo $(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 diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags index 11ffd30..7a9727e 100644 --- a/t/tests/legacy-scripts/tags +++ b/t/tests/legacy-scripts/tags @@ -17,6 +17,7 @@ E: scripts: package-installs-python-bytecode usr/lib/python2.3/site-packages/tes E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/php5foo E: scripts: php-script-but-no-phpX-cli-dep usr/share/scripts/phpfoo E: scripts: python-script-but-no-python-dep usr/bin/py2.Xfoo +E: scripts: python-script-but-no-python-dep usr/bin/py2foo E: scripts: python-script-but-no-python-dep usr/bin/pyfoo E: scripts: shell-script-fails-syntax-check usr/bin/sh-broken E: scripts: wrong-path-for-interpreter usr/bin/lefty-foo (#!/usr/local/bin/lefty != /usr/bin/lefty) @@ -33,6 +34,7 @@ I: scripts: init.d-script-does-not-provide-itself etc/init.d/lsb-broken I: scripts: init.d-script-missing-lsb-short-description etc/init.d/lsb-other I: scripts: no-md5sums-control-file I: scripts: script-in-usr-share-doc usr/share/doc/scripts/py2.Xfoo +I: scripts: script-in-usr-share-doc usr/share/doc/scripts/py2foo I: scripts: script-in-usr-share-doc usr/share/doc/scripts/rubyfoo W: scripts source: ancient-standards-version 3.2.1 (current is CURRENT) W: scripts source: binary-arch-rules-but-pkg-is-arch-indep @@ -56,6 +58,7 @@ W: scripts: binary-without-manpage usr/bin/perl-bizarre-2 W: scripts: binary-without-manpage usr/bin/perl-bizarre-3 W: scripts: binary-without-manpage usr/bin/perlfoo W: scripts: binary-without-manpage usr/bin/py2.Xfoo +W: scripts: binary-without-manpage usr/bin/py2foo W: scripts: binary-without-manpage usr/bin/pyfoo W: scripts: binary-without-manpage usr/bin/rubyfoo W: scripts: binary-without-manpage usr/bin/sh-broken diff --git a/t/tests/legacy-scripts/upstream/py2foo b/t/tests/legacy-scripts/upstream/py2foo new file mode 100755 index 0000000..b519eda --- /dev/null +++ b/t/tests/legacy-scripts/upstream/py2foo @@ -0,0 +1,4 @@ +#! /usr/bin/env python2 + +if __name__ == '__main__': + print 'Hi there' -- 2.10.2
>From 515fa27030f35185268d631c3847b51976a67233 Mon Sep 17 00:00:00 2001 From: Antonio Ospite <a...@ao2.it> Date: Mon, 7 Nov 2016 16:55:26 +0100 Subject: [PATCH 3/3] data/scripts/interpreter.txt: fix false positive with python2 as interpreter When using dh_python2 the package ends up depending on pyhton:any (Debian does not have a python2:any package). However if a script uses python2 as the interpreter, the lintian dependency checks fails: E: scripts: python-script-but-no-python-dep usr/bin/script_name Basically lintian tries to look for a dependency on python2:any, it does not know that python:any is OK as a dependency for scripts using python2 in the shebang line. This can be verified by temporarily adding "python:any" to t/tests/legacy-scripts/debian/debian/control and running the test: debian/rules runtests onlyrun=legacy-scripts Lintian will not give the error anymore for pyfoo, but it will still emit it for py2foo which is wrong. Fix the issue adding python2 to the unversioned interpreters, the rationale being that the python2 interpreter requires unversioned dependencies. After the fix, adding "python:any" to t/tests/legacy-scripts/debian/debian/control does not give the error anymore for py2foo when running: debian/rules runtests onlyrun=legacy-scripts --- data/scripts/interpreters | 1 + 1 file changed, 1 insertion(+) diff --git a/data/scripts/interpreters b/data/scripts/interpreters index 9b02c15..9955e6d 100644 --- a/data/scripts/interpreters +++ b/data/scripts/interpreters @@ -72,6 +72,7 @@ plackup => /usr/bin, libplack-perl procmail => /usr/bin pypy => /usr/bin python => /usr/bin, python:any | python-minimal:any +python2 => /usr/bin, python:any | python-minimal:any pforth => /usr/bin racket => /usr/bin rake => /usr/bin -- 2.10.2