Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-13 Thread Dmitry Bogatov
[2019-02-11 19:23] Chris Lamb 
>
> part   text/plain 414
> Hi Dmitry,
>
> > Yes. Sorry, but I do not understand, how to test tags with severity
> > 'classification'. It seems to not appear in output, that is
> > compared with t/tags/checks/*/tags.
>
> Look at how, for example:
>
>   t/tags/checks/scripts/scripts-maintainer-script-classification
>
> … works. :)

Thank you. Found. Options -L classification -C python. One more attempt.

From ffed4731e2b79091a965e0536ce2f9763948dc6e Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov 
Date: Sat, 2 Feb 2019 01:39:59 +
Subject: [PATCH] New tag: script-uses-unversioned-python-in-shebang

  * checks/python.desc: Add description for new tag
  * checks/python.pm: check shebang of script for references
to unversioned python, either directly or via /usr/bin/env.
  * t/tags/tests/python-script-uses-unversioned-python-in-shebang: new
test directory.
---
 checks/python.desc | 18 ++
 checks/python.pm   | 12 
 .../debian/control.in  | 16 
 .../debian/install |  1 +
 .../debian/rules   |  4 
 .../debian/script-bad1 |  1 +
 .../debian/script-bad2 |  1 +
 .../debian/script-good1|  1 +
 .../debian/script-good2|  1 +
 .../desc   |  5 +
 .../tags   |  2 ++
 11 files changed, 62 insertions(+)
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
 create mode 100755 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/desc
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/tags

diff --git a/checks/python.desc b/checks/python.desc
index f8d73e4fd..661e6cc86 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -198,3 +198,21 @@ Info: This source package encodes a Python version in its 
name such
  .
  Please override this tag with a suitably-commented override if
  there is no single upstream codebase that supports both versions.
+
+Tag: script-uses-unversioned-python-in-shebang
+Severity: classification
+Certainty: certain
+Info: The package contain script with unversion python shebang.
+ There is discussion in python community to recommend soft-linking
+ python to python3 on newer distributions.
+ .
+ If and when Debian start following this recommendation, the script
+ will be broken.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ by upstream past 2020 and will likely be dropped after the release of
+ Debian "buster".
+ .
+ If upstream have not moved or have no intention to move to Python 3, please
+ be certain that Debian would benefit from the continued inclusion of this
+ package and, if not, consider removing it.
diff --git a/checks/python.pm b/checks/python.pm
index ea1545254..0a6a2eb6d 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -246,6 +246,18 @@ sub _run_binary {
 }
 }
 
+# Check for unversioned python shebang (#909510).
+for my $file ($info->sorted_index) {
+next unless $file->is_file;
+next unless $file->is_open_ok;
+next unless $file =~ m,(usr/)?bin/[^/]+,;
+my $fd = $file->open();
+my $line = <$fd>;
+tag 'script-uses-unversioned-python-in-shebang', $file
+if $line =~ m,^#!\s*(/usr/bin/env\s*)?(/usr/bin/)?python$,;
+close($fd);
+}
+
 return;
 }
 
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
new file mode 100644
index 0..6bae81f3e
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: mail
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: prog-{$source}
+Architecture: {$package_architecture}
+Depends: $\{misc:Depends\}, python, python2.7
+Description: Package with Python script with bad shebang
+ This is a test package designed to exercis

Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-11 Thread Chris Lamb
Hi Dmitry,

> Yes. Sorry, but I do not understand, how to test tags with severity
> 'classification'. It seems to not appear in output, that is
> compared with t/tags/checks/*/tags.

Look at how, for example:

  t/tags/checks/scripts/scripts-maintainer-script-classification

… works. :)



Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org 🍥 chris-lamb.co.uk
   `-



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-11 Thread Dmitry Bogatov


[2019-02-10 12:46] Chris Lamb 
>
> part   text/plain 238
> Hi Dmitry,
>
> > +Severity: classification
>
> Replying quickly, excuse terseness; you appear to have removed the
> tests?

Yes. Sorry, but I do not understand, how to test tags with severity
'classification'. It seems to not appear in output, that is
compared with t/tags/checks/*/tags.

Seems, they are supposed to appear with prefix 'C: ', but it does not
work for me. Here is version of patch with test included, but it does
not actually test for 'python-script-uses-unversioned-python-in-shebang'.

From 7cd1d83c41349844cfd82d7ebf9c2cadcfa13236 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov 
Date: Sat, 2 Feb 2019 01:39:59 +
Subject: [PATCH] New tag: script-uses-unversioned-python-in-shebang

  * checks/python.desc: Add description for new tag
  * checks/python.pm: check shebang of script for references
to unversioned python, either directly or via /usr/bin/env.
  * t/tags/tests/python-script-uses-unversioned-python-in-shebang: new
test directory.
---
 checks/python.desc | 18 ++
 checks/python.pm   | 12 
 .../debian/control.in  | 16 
 .../debian/install |  1 +
 .../debian/rules   |  4 
 .../debian/script-bad1 |  1 +
 .../debian/script-bad2 |  1 +
 .../debian/script-good1|  1 +
 .../debian/script-good2|  1 +
 .../desc   |  4 
 .../tags   |  4 
 11 files changed, 63 insertions(+)
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
 create mode 100755 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/desc
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/tags

diff --git a/checks/python.desc b/checks/python.desc
index f8d73e4fd..661e6cc86 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -198,3 +198,21 @@ Info: This source package encodes a Python version in its 
name such
  .
  Please override this tag with a suitably-commented override if
  there is no single upstream codebase that supports both versions.
+
+Tag: script-uses-unversioned-python-in-shebang
+Severity: classification
+Certainty: certain
+Info: The package contain script with unversion python shebang.
+ There is discussion in python community to recommend soft-linking
+ python to python3 on newer distributions.
+ .
+ If and when Debian start following this recommendation, the script
+ will be broken.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ by upstream past 2020 and will likely be dropped after the release of
+ Debian "buster".
+ .
+ If upstream have not moved or have no intention to move to Python 3, please
+ be certain that Debian would benefit from the continued inclusion of this
+ package and, if not, consider removing it.
diff --git a/checks/python.pm b/checks/python.pm
index ea1545254..0a6a2eb6d 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -246,6 +246,18 @@ sub _run_binary {
 }
 }
 
+# Check for unversioned python shebang (#909510).
+for my $file ($info->sorted_index) {
+next unless $file->is_file;
+next unless $file->is_open_ok;
+next unless $file =~ m,(usr/)?bin/[^/]+,;
+my $fd = $file->open();
+my $line = <$fd>;
+tag 'script-uses-unversioned-python-in-shebang', $file
+if $line =~ m,^#!\s*(/usr/bin/env\s*)?(/usr/bin/)?python$,;
+close($fd);
+}
+
 return;
 }
 
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
new file mode 100644
index 0..6bae81f3e
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: mail
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: prog-{$source}
+Architecture: {$package_architecture}
+Depends: $\{misc:Dep

Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-10 Thread Chris Lamb
Hi Dmitry,

> +Severity: classification

Replying quickly, excuse terseness; you appear to have removed the
tests?


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org 🍥 chris-lamb.co.uk
   `-



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-09 Thread Dmitry Bogatov


[2019-02-07 16:34] Chris Lamb 
> > [Dmitry Bogatov]
> > Sorry, I understood phrase "get numbers" as [...]
>
> I think I've confused you further now, alas. We can use Lintian to
> accurate discover these numbers — my point is basically that it
> cannot be "Severity: wishlist" as this would be asking maintainers
> to change their packages.
>
> Take a look at "Classification" tags for inspiration.

Thank you for suggestion. Another attempt.

commit 13718506e68b1dea078ed966fcd383116f4e953a
Author: Dmitry Bogatov 
Date:   Sat Feb 2 01:39:59 2019 +

New tag: script-uses-unversioned-python-in-shebang

  * checks/python.desc: Add description for new tag.
  * checks/python.pm: check shebang of script for references
to unversioned python, either directly or via /usr/bin/env.

diff --git a/checks/python.desc b/checks/python.desc
index f8d73e4fd..661e6cc86 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -198,3 +198,21 @@ Info: This source package encodes a Python version in its 
name such
  .
  Please override this tag with a suitably-commented override if
  there is no single upstream codebase that supports both versions.
+
+Tag: script-uses-unversioned-python-in-shebang
+Severity: classification
+Certainty: certain
+Info: The package contain script with unversion python shebang.
+ There is discussion in python community to recommend soft-linking
+ python to python3 on newer distributions.
+ .
+ If and when Debian start following this recommendation, the script
+ will be broken.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ by upstream past 2020 and will likely be dropped after the release of
+ Debian "buster".
+ .
+ If upstream have not moved or have no intention to move to Python 3, please
+ be certain that Debian would benefit from the continued inclusion of this
+ package and, if not, consider removing it.
diff --git a/checks/python.pm b/checks/python.pm
index ea1545254..0a6a2eb6d 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -246,6 +246,18 @@ sub _run_binary {
 }
 }
 
+# Check for unversioned python shebang (#909510).
+for my $file ($info->sorted_index) {
+next unless $file->is_file;
+next unless $file->is_open_ok;
+next unless $file =~ m,(usr/)?bin/[^/]+,;
+my $fd = $file->open();
+my $line = <$fd>;
+tag 'script-uses-unversioned-python-in-shebang', $file
+if $line =~ m,^#!\s*(/usr/bin/env\s*)?(/usr/bin/)?python$,;
+close($fd);
+}
+
 return;
 }
 

-- 
Note, that I send and fetch email in batch, once every 24 hours.
 If matter is urgent, try https://t.me/kaction
 --



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-07 Thread Chris Lamb
Dmitry,

> > > +Severity: wishlist
> >
> > Again, weren't we just doing this to get numbers at first?
[…]
> Sorry, I understood phrase "get numbers" as
> 
>   let's create check, set severity to low and see numbers on
>   lintial.debian.org
> 
> According to codesearch, there is 18 packages, that refer to
> '#!/usr/bin/env python'.

I think I've confused you further now, alas. We can use Lintian to
accurate discover these numbers — my point is basically that it
cannot be "Severity: wishlist" as this would be asking maintainers
to change their packages.

Take a look at "Classification" tags for inspiration & ACK that
codesearch will be missing stuff.


Best wishes,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org 🍥 chris-lamb.co.uk
   `-



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-07 Thread Dmitry Bogatov
[2019-02-05 18:31] Chris Lamb 
>
> part   text/plain 432
> Hi Dmitry,
>
> > +Tag: script-uses-unversioned-python-in-shebang
> > +Severity: wishlist
>
> Again, weren't we just doing this to get numbers at first? Unless
> I'm missing something (quite possible!) I do not believe we are at
> a point in time where we wish to be implicitly asking maintainers
> to "fix" these shebangs.

Sorry, I understood phrase "get numbers" as

let's create check, set severity to low and see numbers on
lintial.debian.org

According to codesearch, there is 18 packages, that refer to
'#!/usr/bin/env python'. Not all matches are in shebang.

There is approximately 2000 packages, that contain #!/usr/bin/python,
mostly in shebang.

Both these searches are very, very inaccurate, since:

 * #!/usr/bin/python3 matches too, since '#!/usr/bin/python$' does not
   work on codesearch. But I scrolled several pages, and, strangely,
   this false-positive seems to be rare.

 * codesearch searches in source packages, and binary packages can get
   shebang fixed during build.

On my system, here is list of scripts with '#![ ]?/usr/bin/python$'
shebang:

archivemail
debsecan
dh_python2
netaddr
rst2html
rst2html4
rst2html5
rst2latex
rst2man
rst2odt
rst2odt_prepstyles
rst2pseudoxml
rst2s5
rst2xetex
rst2xml
rst-buildhtml
rstpep2html

That is all I know. I do not have access to computer, capable of
processing all binary packages with `Depends: python2 | python2.7'
-- 
Note, that I send and fetch email in batch, once every 24 hours.
 If matter is urgent, try https://t.me/kaction
 --



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-05 Thread Chris Lamb
Hi Dmitry,

> +Tag: script-uses-unversioned-python-in-shebang
> +Severity: wishlist

Again, weren't we just doing this to get numbers at first? Unless
I'm missing something (quite possible!) I do not believe we are at
a point in time where we wish to be implicitly asking maintainers
to "fix" these shebangs.


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org 🍥 chris-lamb.co.uk
   `-



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-04 Thread Dmitry Bogatov


  * checks/python.desc: Add description for new tag
  * checks/python.pm: check shebang of script for references
to unversioned python, either directly or via /usr/bin/env.
  * t/tags/tests/python-script-uses-unversioned-python-in-shebang: new
test directory.
---
 checks/python.desc | 18 ++
 checks/python.pm   | 12 
 .../debian/control.in  | 16 
 .../debian/install |  1 +
 .../debian/rules   |  4 
 .../debian/script-bad1 |  1 +
 .../debian/script-bad2 |  1 +
 .../debian/script-good1|  1 +
 .../debian/script-good2|  1 +
 .../desc   |  6 ++
 .../tags   |  6 ++
 11 files changed, 67 insertions(+)
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
 create mode 100755 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/desc
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/tags

diff --git a/checks/python.desc b/checks/python.desc
index f8d73e4fd..2837aedb9 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -198,3 +198,21 @@ Info: This source package encodes a Python version in its 
name such
  .
  Please override this tag with a suitably-commented override if
  there is no single upstream codebase that supports both versions.
+
+Tag: script-uses-unversioned-python-in-shebang
+Severity: wishlist
+Certainty: certain
+Info: The package contain script with unversion python shebang.
+ There is discussion in python community to recommend soft-linking
+ python to python3 on newer distributions.
+ .
+ If and when Debian start following this recommendation, the script
+ will be broken.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ by upstream past 2020 and will likely be dropped after the release of
+ Debian "buster".
+ .
+ If upstream have not moved or have no intention to move to Python 3, please
+ be certain that Debian would benefit from the continued inclusion of this
+ package and, if not, consider removing it.
diff --git a/checks/python.pm b/checks/python.pm
index ea1545254..0a6a2eb6d 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -246,6 +246,18 @@ sub _run_binary {
 }
 }
 
+# Check for unversioned python shebang (#909510).
+for my $file ($info->sorted_index) {
+next unless $file->is_file;
+next unless $file->is_open_ok;
+next unless $file =~ m,(usr/)?bin/[^/]+,;
+my $fd = $file->open();
+my $line = <$fd>;
+tag 'script-uses-unversioned-python-in-shebang', $file
+if $line =~ m,^#!\s*(/usr/bin/env\s*)?(/usr/bin/)?python$,;
+close($fd);
+}
+
 return;
 }
 
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
new file mode 100644
index 0..6bae81f3e
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: mail
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: prog-{$source}
+Architecture: {$package_architecture}
+Depends: $\{misc:Depends\}, python, python2.7
+Description: Package with Python script with bad shebang
+ 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/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
new file mode 100644
index 0..05e2b7892
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
@@ -0,0 +1 @@
+debian/script-* /usr/bin
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules 
b/t/tags/tests/python-

Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-02 Thread Chris Lamb
Hi Dmitry,

> +Tag: script-uses-unversioned-python-in-shebang
> +Severity: normal
 ^^

Hmm, I thought we were just going to use this to see the numbers
rather than ask maintainers to "fix" this?

> +# Check for unversioned python shebang (#909510).
> +for my $file ($info->sorted_index) {
> +next unless $file->is_file;

(I think we want to check "is_open_ok" here too?)


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org 🍥 chris-lamb.co.uk
   `-



Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang

2019-02-02 Thread Dmitry Bogatov


  * checks/python.desc: Add description for new tag
  * checks/python.pm: check shebang of script for references
to unversioned python, either directly or via /usr/bin/env.
  * t/tags/tests/python-script-uses-unversioned-python-in-shebang: new
test directory.
---
 checks/python.desc | 18 ++
 checks/python.pm   | 11 +++
 .../debian/control.in  | 16 
 .../debian/install |  1 +
 .../debian/rules   |  4 
 .../debian/script-bad1 |  1 +
 .../debian/script-bad2 |  1 +
 .../debian/script-good1|  1 +
 .../debian/script-good2|  1 +
 .../desc   |  6 ++
 .../tags   |  6 ++
 11 files changed, 66 insertions(+)
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
 create mode 100755 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-bad2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good1
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/script-good2
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/desc
 create mode 100644 
t/tags/tests/python-script-uses-unversioned-python-in-shebang/tags

diff --git a/checks/python.desc b/checks/python.desc
index f8d73e4fd..a31e7b923 100644
--- a/checks/python.desc
+++ b/checks/python.desc
@@ -198,3 +198,21 @@ Info: This source package encodes a Python version in its 
name such
  .
  Please override this tag with a suitably-commented override if
  there is no single upstream codebase that supports both versions.
+
+Tag: script-uses-unversioned-python-in-shebang
+Severity: normal
+Certainty: certain
+Info: The package contain script with unversion python shebang.
+ There is discussion in python community to recommend soft-linking
+ python to python3 on newer distributions.
+ .
+ If and when Debian start following this recommendation, the script
+ will be broken.
+ .
+ The 2.x series of Python is due for deprecation and will not be maintained
+ by upstream past 2020 and will likely be dropped after the release of
+ Debian "buster".
+ .
+ If upstream have not moved or have no intention to move to Python 3, please
+ be certain that Debian would benefit from the continued inclusion of this
+ package and, if not, consider removing it.
diff --git a/checks/python.pm b/checks/python.pm
index ea1545254..65b795552 100644
--- a/checks/python.pm
+++ b/checks/python.pm
@@ -246,6 +246,17 @@ sub _run_binary {
 }
 }
 
+# Check for unversioned python shebang (#909510).
+for my $file ($info->sorted_index) {
+next unless $file->is_file;
+next unless $file =~ m,(usr/)?bin/[^/]+,;
+my $fd = $file->open();
+my $line = <$fd>;
+tag 'script-uses-unversioned-python-in-shebang', $file
+if $line =~ m,^#!\s*(/usr/bin/env\s*)?(/usr/bin/)?python$,;
+close($fd);
+}
+
 return;
 }
 
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
new file mode 100644
index 0..6bae81f3e
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: mail
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: prog-{$source}
+Architecture: {$package_architecture}
+Depends: $\{misc:Depends\}, python, python2.7
+Description: Package with Python script with bad shebang
+ 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/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
new file mode 100644
index 0..05e2b7892
--- /dev/null
+++ 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/install
@@ -0,0 +1 @@
+debian/script-* /usr/bin
diff --git 
a/t/tags/tests/python-script-uses-unversioned-python-in-shebang/debian/rules 
b/t/tags/tests/python-script-uses-unversioned-python-in-shebang/d