Bug#891538: installed hook fails completely
[2018-02-26 09:05] Antoine Beaupre > part text/plain1568 > Package: gitlint > Version: 0.9.0-2 > Severity: important > > The hook installed with `gitlint install-hook` fails completely when > called through a commit: > > gitlint: checking commit message... > /usr/bin/python: No module named gitlint Dear maintainer, I prepared patch that fix this issue. If you do not object, I will NMU it in a week or so. diff -Nru gitlint-0.9.0/debian/changelog gitlint-0.9.0/debian/changelog --- gitlint-0.9.0/debian/changelog 2018-02-18 21:48:41.0 + +++ gitlint-0.9.0/debian/changelog 2018-11-25 18:57:11.0 + @@ -1,3 +1,10 @@ +gitlint (0.9.0-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Make sure gitlint is correctly called from commit hook (Closes: #891538) + + -- Dmitry Bogatov Sun, 25 Nov 2018 18:57:11 + + gitlint (0.9.0-2) unstable; urgency=medium * Add missing dependency python3-sh (Closes: #887789) diff -Nru gitlint-0.9.0/debian/patches/Fix-gitlint-invocation-in-git-hook gitlint-0.9.0/debian/patches/Fix-gitlint-invocation-in-git-hook --- gitlint-0.9.0/debian/patches/Fix-gitlint-invocation-in-git-hook 1970-01-01 00:00:00.0 + +++ gitlint-0.9.0/debian/patches/Fix-gitlint-invocation-in-git-hook 2018-11-25 18:57:11.0 + @@ -0,0 +1,15 @@ +Description: Make sure gitlint is correctly called from commit hook +Author: Dmitry Bogatov +Bug-Debian: https://bugs.debian.org/891538 + +--- gitlint-0.9.0.orig/gitlint/files/commit-msg gitlint-0.9.0/gitlint/files/commit-msg +@@ -26,7 +26,7 @@ fi + + run_gitlint(){ +echo "gitlint: checking commit message..." +- cat "$1" | python -m gitlint.cli ++ cat "$1" | python3 +gitlint_exit_code=$? + } + diff -Nru gitlint-0.9.0/debian/patches/series gitlint-0.9.0/debian/patches/series --- gitlint-0.9.0/debian/patches/series 2018-02-18 21:48:41.0 + +++ gitlint-0.9.0/debian/patches/series 2018-11-25 18:57:11.0 + @@ -2,3 +2,4 @@ 0002-Change-get_sample-and-get_expected-to-context.patch 0003-Fix-regexp-matching-in-tests.patch 0004-Remove-duplicate-line.patch +Fix-gitlint-invocation-in-git-hook
Bug#891538: installed hook fails completely
Package: gitlint Version: 0.9.0-2 Severity: important The hook installed with `gitlint install-hook` fails completely when called through a commit: gitlint: checking commit message... /usr/bin/python: No module named gitlint --- gitlint: Your commit message contains the above violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] e This is because gitlint is installed in Python3, not "Python" (which is Python2). Changing the binary to `python3` works around this issue, I also wonder why there's a shell script wrapper there, which is bound to fail that way instead of just calling the binary with some special argument Furthermore, calling `python -m` is allowed in development, but shouldn't be used in production, as it adds the current directory to the search path, as security liability... -- System Information: Debian Release: 9.3 APT prefers stable APT policy: (500, 'stable'), (1, 'experimental'), (1, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores) Locale: LANG=fr_CA.UTF-8, LC_CTYPE=fr_CA.UTF-8 (charmap=UTF-8), LANGUAGE=fr_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) Versions of packages gitlint depends on: ii git1:2.11.0-3+deb9u2 ii python33.5.3-1 ii python3-arrow 0.10.0-1 ii python3-click 6.6-1 ii python3-sh 1.11-1 gitlint recommends no packages. gitlint suggests no packages. -- no debconf information