[Reproducible-builds] [dh-python] 155/183: Make sure only first line is taken into account while checking shebangs
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Sep 19 15:30:33 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dh-python.
commit 791609b7e0c743a33cc6071949609e59f678abcd
Author: Piotr Ożarowski <piotr at debian.org>
Date: Mon Jan 27 21:23:42 2014 +0100
Make sure only first line is taken into account while checking shebangs
---
debian/changelog | 2 ++
dhpython/interpreter.py | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 3df1578..031b85d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ dh-python (1.20131021-2) UNRELEASED; urgency=low
* dh_python3, dh_pypy: add support for debian/package.pyremove files
* dh_python3: add multiarch tuples to all already tagged extensions if
when more than one Python 3 version is supported (closes: 733128)
+ * Make sure only first line is taken into account while checking shebangs
+ (closes: 732308)
-- Piotr Ożarowski <piotr at debian.org> Tue, 05 Nov 2013 22:57:20 +0100
diff --git a/dhpython/interpreter.py b/dhpython/interpreter.py
index a1b09b9..859dd2f 100644
--- a/dhpython/interpreter.py
+++ b/dhpython/interpreter.py
@@ -204,7 +204,12 @@ class Interpreter:
data = fp.read(96)
if b"\0" in data:
raise ValueError('cannot parse binary file')
- parsed = cls.parse(str(data, 'utf-8'))
+ # make sure only first line is checkeed
+ data = str(data, 'utf-8').split('\n')[0]
+ if not data.startswith('#!'):
+ raise ValueError("doesn't look like a shebang: %s" % data)
+
+ parsed = cls.parse(data)
if not parsed:
raise ValueError("doesn't look like a shebang: %s" % data)
for key, val in parsed.items():
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dh-python.git
More information about the Reproducible-builds
mailing list