Bug#909510: [PATCH] New tag: script-uses-unversioned-python-in-shebang
[2019-02-07 16:34] Chris Lamb <lamby@debian.org>
> > [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 <KAction@debian.org>
Date: Sat Feb 2 01:39:59 2019 +0000
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
--
Reply to: