[Pkg-dkms-commits] [dkms] 03/03: Make dh_dkms name and version parsing more proper (Closes: #829123)

Aron Xu aron at debian.org
Sun Jul 3 16:01:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

aron pushed a commit to branch master
in repository dkms.

commit 7b89c302b7ff6e98a480a7554009020b874c7b1f
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Sun Jul 3 23:47:33 2016 +0800

    Make dh_dkms name and version parsing more proper (Closes: #829123)
---
 ...uld-fail-cleanly-with-unknown-package-ver.patch | 41 ++++++++++++++++++++++
 ...-conf-files-where-PACKAGE_VERSION-or-PACK.patch | 35 ++++++++++++++++++
 debian/patches/series                              |  2 ++
 3 files changed, 78 insertions(+)

diff --git a/debian/patches/0001-dh_dkms-should-fail-cleanly-with-unknown-package-ver.patch b/debian/patches/0001-dh_dkms-should-fail-cleanly-with-unknown-package-ver.patch
new file mode 100644
index 0000000..44cc052
--- /dev/null
+++ b/debian/patches/0001-dh_dkms-should-fail-cleanly-with-unknown-package-ver.patch
@@ -0,0 +1,41 @@
+>From b5f07ba60f76030b09f2f44db3ebe0487fb4ff25 Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Thu, 30 Jun 2016 14:08:49 -0400
+Subject: [PATCH 1/2] dh_dkms should fail cleanly with unknown package version
+ or name
+
+In some cases, the dkms file is mis-written, or the dh_dkms file
+parsing is too brittle to find the package name or version.
+
+in these cases, dh_dkms proceeds through, but spews errors like the
+following:
+
+Use of uninitialized value $package_version in concatenation (.) or string at /usr/bin/dh_dkms line 150.
+Use of uninitialized value $package_version in concatenation (.) or string at /usr/bin/dh_dkms line 152.
+Use of uninitialized value $package_version in concatenation (.) or string at /usr/bin/dh_dkms line 154.
+
+This patch catches the error and reports it cleanly as an error.
+---
+ debian/scripts/dh_dkms | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/debian/scripts/dh_dkms b/debian/scripts/dh_dkms
+index f2644ad..f5a1c4b 100755
+--- a/debian/scripts/dh_dkms
++++ b/debian/scripts/dh_dkms
+@@ -147,6 +147,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
+ 		doit("sed", "-i", "s/#MODULE_VERSION#/$package_version/g", $name);
+ 	}
+ 
++        error "could not determine package name"
++          unless defined($package_name);
++
++        error "could not determine package version"
++          unless defined($package_version);
++
+ 	autoscript($package, "prerm", "prerm-dkms",
+ 	    "s/#MODULE_NAME#/$package_name/;s/#MODULE_VERSION#/$package_version/");
+ 	autoscript($package, "postinst", "postinst-dkms",
+-- 
+2.8.1
+
diff --git a/debian/patches/0002-handle-dkms-conf-files-where-PACKAGE_VERSION-or-PACK.patch b/debian/patches/0002-handle-dkms-conf-files-where-PACKAGE_VERSION-or-PACK.patch
new file mode 100644
index 0000000..15be5a5
--- /dev/null
+++ b/debian/patches/0002-handle-dkms-conf-files-where-PACKAGE_VERSION-or-PACK.patch
@@ -0,0 +1,35 @@
+>From eaeb55be19ca37c7a09d04bc9d6160cf9d03a145 Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Thu, 30 Jun 2016 14:02:16 -0400
+Subject: [PATCH 2/2] handle dkms conf files where PACKAGE_VERSION or
+ PACKAGE_NAME is unquoted
+
+Some dkms.conf files do not quote PACKAGE_VERSION or PACKAGE_NAME,
+like:
+
+PACKAGE_NAME=blah
+PACKAGE_VERSION=0.0.0
+
+This patch lets dh_dkms grok this syntax.
+---
+ debian/scripts/dh_dkms | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/debian/scripts/dh_dkms b/debian/scripts/dh_dkms
+index f5a1c4b..48fe8b3 100755
+--- a/debian/scripts/dh_dkms
++++ b/debian/scripts/dh_dkms
+@@ -116,8 +116,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
+ 	# now, parse our configuration file
+ 	open(IN, "< $name");
+ 	while (my $l = <IN>) {
+-		$l =~ /PACKAGE_NAME=(["'])(.*)\1/ && ($is_snippet = 1 && $package_name = $2);
+-		$l =~ /PACKAGE_VERSION=(["'])(.*)\1/ && ($package_version = $2);
++		$l =~ /PACKAGE_NAME=(["']?)(.*)\1/ && ($is_snippet = 1 && $package_name = $2);
++		$l =~ /PACKAGE_VERSION=(["']?)(.*)\1/ && ($package_version = $2);
+ 	}
+ 	close(IN);
+ 
+-- 
+2.8.1
+
diff --git a/debian/patches/series b/debian/patches/series
index cb982fe..f158da0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,5 @@ apport-write-binary.patch
 parallell-build.patch
 690866-helpmsg.patch
 653176.patch
+0001-dh_dkms-should-fail-cleanly-with-unknown-package-ver.patch
+0002-handle-dkms-conf-files-where-PACKAGE_VERSION-or-PACK.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-dkms/dkms.git



More information about the Pkg-dkms-commits mailing list