Package: dkms
Version: 2.2.0.3-1.3
Tags: patch
Followup-For: Bug #758485

This is a Followup-For: Bug #757758 too.

The attached patch attempts to correct the error(s) and adds some
small code improvement.

The bottom line is the arrays 'sa_mc_o' and 'sa_sck_o' are empty and
`sed' is run without a script.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages dkms depends on:
ii  build-essential  11.7
ii  coreutils        8.23-2
ii  dpkg-dev         1.17.13
ii  gcc              4:4.9.1-4
ii  kmod             18-1
ii  make             4.0-8
ii  patch            2.7.1-6

Versions of packages dkms recommends:
ii  fakeroot             1.20.1-1.1
ii  linux-headers-amd64  3.16+60
pn  linux-image          <none>
ii  menu                 2.1.47
ii  sudo                 1.8.9p5-1

dkms suggests no packages.

-- Configuration Files:
/etc/modprobe.d/dkms.conf changed:


-- no debconf information

-- debsums errors found:
debsums: changed file /usr/sbin/dkms (from dkms package)


Cheers,

-- 
Cristian
--- /usr/sbin/dkms.orig	2014-08-21 05:45:15.000000000 +0200
+++ /usr/sbin/dkms	2014-09-14 15:04:28.810595244 +0200
@@ -745,6 +745,11 @@
     [[ ${modules_conf_obsoletes[@]} ]] || return 0
     # generate sed args to remove obsolete modules
     local mod_diff
+
+    # FIXME: /etc/modules.conf and /etc/sysconfig/kernel style syntax are
+    #        mentioned here, but I'm also seeing /etc/modprobe.d/dkms and
+    #        /etc/modprobe.d/nvidia-current.conf which will be treated as
+    #        non- /etc/sysconfig/kernel; is that correct?
     for ((index=0; index < ${#dest_module_name[@]}; index++)); do
 	[[ ${modules_conf_obsoletes[$index]} ]] || continue
 	for obsolete_module in ${modules_conf_obsoletes[$index]//,/ }; do
@@ -761,16 +766,17 @@
     # do all the changes at once, record the diffs for posterity
     for file in "$@"; do
 	[[ $file && -w $file ]] || continue
+	_tmpf="$temp_dir_name/${file##*/}.new"
 	if [[ $file = /etc/sysconfig/kernel ]]; then
-	    sed "${sa_sck_o[@]}" "$file" > "$temp_dir_name/${file##*/}.new"
+	    [ -z "${sa_sck_o[@]}" ] || sed "${sa_sck_o[@]}" "$file" > "$_tmpf"
 	else
-	    sed "${sa_mc_o[@]}" "$file" > "$temp_dir_name/${file##*/}.new"
+	    [ -z "${sa_mc_o[@]}" ] || sed "${sa_mc_o[@]}" "$file" > "$_tmpf"
 	fi
-	if ! mod_diff=$(diff -u "$temp_dir_name/${file##*/}.new" "$file"); then
+	if [ -f "$_tmpf" ] && ! mod_diff=$(diff -u "$_tmpf" "$file"); then
 	    echo $"$file updated to replace obsoleted module references:"
 	    echo "$mod_diff"
-	    cp -fp "$temp_dir_name/${file##*/}.new" "$file"
-	    rm -f "$temp_dir_name/${file##*/}.new"
+	    cp -fp "$_tmpf" "$file"
+	    rm -f "$_tmpf"
 	fi
     done
 }

Reply via email to