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

Bug#743599: lintian: false positive python-script-but-no-python-dep when using #!/usr/bin/python2



Control: tags -1 patch

On Tue, 29 Nov 2016 20:56:00 +0000
Niels Thykier <niels@thykier.net> wrote:

> 
> Hi,
> 
> Thanks for the provided patches.
> 
[...]
> 
> I have applied the changes to the test case.  However, the changes to
> the data files (regardless of which one I apply) cause a test regression
> there after AFAICT.
>
> The test failure is:
> > $ t/runtests -k -j1 t debian/test-out legacy-scripts
> > ENV[PATH]=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> > tests::legacy-scripts: diff -u t/tests/legacy-scripts/tags [...]/tests/scripts/tags.scripts
> > --- t/tests/legacy-scripts/tags 2016-11-29 20:42:28.674312854 +0000
> > +++ [...]/tests/scripts/tags.scripts        2016-11-29 20:50:22.238324980 +0000
> > @@ -13,11 +13,11 @@
> >  E: scripts: init.d-script-needs-depends-on-lsb-base etc/init.d/skeleton (line 40)
> >  E: scripts: missing-dep-for-interpreter jruby => jruby | jruby1.0 | jruby1.1 | jruby1.2 (usr/bin/jruby-broken)
> >  E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo)
> > +E: scripts: missing-dep-for-interpreter python2 => python:any | python-minimal:any (usr/bin/py2foo)
> >  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/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)
> > fail tests::legacy-scripts: output differs!
> 
> I don't think that change was intentional, so I am sending the patch
> back for another review.
>

Lintian is right, I forgot to add the changes to
t/tests/legacy-scripts/tags.

New patch attached, rebased on top of the master branch.

I also updated the commit message to explain why the emitted error
changed, I hope it explains the changes clearly enough.

Thanks,
   Antonio

-- 
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 347c834e66b9d21d7379ec2a32907d21c378a759 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Mon, 7 Nov 2016 16:55:26 +0100
Subject: [PATCHv2] 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, lintian will give a clearer error when the dependency is
really missing:

  E: scripts: missing-dep-for-interpreter python2 => python:any | python-minimal:any (usr/bin/py2foo)

And to prove that the false positive is not occurring anymore,
temporarily adding "python:any" to
t/tests/legacy-scripts/debian/debian/control will not give the error
anymore for py2foo either when running:

  debian/rules runtests onlyrun=legacy-scripts
---
 data/scripts/interpreters   | 1 +
 t/tests/legacy-scripts/tags | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/data/scripts/interpreters b/data/scripts/interpreters
index 81100d2..3f5e2d5 100644
--- a/data/scripts/interpreters
+++ b/data/scripts/interpreters
@@ -73,6 +73,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
diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags
index 58d6d62..913844d 100644
--- a/t/tests/legacy-scripts/tags
+++ b/t/tests/legacy-scripts/tags
@@ -13,13 +13,13 @@ E: scripts: init.d-script-has-unterminated-lsb-section etc/init.d/lsb-broken:15
 E: scripts: init.d-script-needs-depends-on-lsb-base etc/init.d/skeleton (line 40)
 E: scripts: missing-dep-for-interpreter jruby => jruby | jruby1.0 | jruby1.1 | jruby1.2 (usr/bin/jruby-broken)
 E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo)
+E: scripts: missing-dep-for-interpreter python2 => python:any | python-minimal:any (usr/bin/py2foo)
 E: scripts: package-installs-python-bytecode usr/lib/python2.3/site-packages/test.pyc
 E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/php7.0envfoo
 E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/php7.0foo
 E: scripts: php-script-but-no-php-cli-dep usr/share/scripts/phpenvfoo
 E: scripts: php-script-but-no-php-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)
-- 
2.10.2


Reply to: