[Pkg-dkms-maint] Bug#529059: dkms: please use dpkg-divert

A Mennucc mennucc1 at debian.org
Sun May 17 14:08:09 UTC 2009


Package: dkms
Version: 2.0.21.1-1
Severity: wishlist


hi,

when dkms installs, it may override an existing kernel module
by a new one. To this end, dkms moves away the old module using 'mv'

But this breaks if the kernel is upated/reinstalled (as for example
after the recent security updates). 

There is though a more effective way, and it is to use dpkg-divert

The attached patch is a proof-of-concept.

a.

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dkms depends on:
ii  build-essential               11.4       Informational list of build-essent
ii  dpkg-dev                      1.14.25    Debian package development tools
ii  gcc                           4:4.3.2-2  The GNU C compiler
ii  make                          3.81-5     The GNU version of the "make" util
ii  module-init-tools             3.4-1      tools for managing Linux kernel mo

Versions of packages dkms recommends:
ii  fakeroot                 1.11            Gives a fake root environment
ii  linux-headers-2.6.26-1-6 2.6.26-13lenny2 Header files for Linux 2.6.26-1-68
ii  linux-headers-2.6.26-2-6 2.6.26-15lenny2 Header files for Linux 2.6.26-2-68
ii  linux-image-2.6.26-1-686 2.6.26-13lenny2 Linux 2.6.26 image on PPro/Celeron
ii  linux-image-2.6.26-2-686 2.6.26-15lenny2 Linux 2.6.26 image on PPro/Celeron
ii  lsb-release              3.2-20          Linux Standard Base version report
ii  menu                     2.1.41          generates programs menu for all me
ii  patch                    2.5.9-5         Apply a diff file to an original
ii  sudo                     1.6.9p17-2      Provide limited super user privile

dkms suggests no packages.

-- no debconf information

-- 
Andrea Mennucc
 "E' un mondo difficile. Che vita intensa!" (Tonino Carotone)
-------------- next part --------------
--- /var/tmp/dkms.2	2009-05-17 15:48:57.000000000 +0200
+++ /usr/sbin/dkms	2009-05-17 15:57:46.000000000 +0200
@@ -1209,7 +1209,7 @@
 		dup_tree=`echo $module_dup | sed "s#^$lib_tree##" | sed "s#${dest_module_name[$count]}$module_suffix##"`
 		echo $"     - Stored $module_dup"
 		mkdir -p "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
-		mv -f $module_dup "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree"
+		dpkg-divert --add --rename --divert "$dkms_tree/$module/original_module/${kernelver_array[0]}/${arch_array[0]}/collisions/$dup_tree/$module_dup"  $module_dup
 	    done
 	fi
 
@@ -1553,7 +1553,7 @@
 		echo $"   - Archived original module found in the DKMS tree"
 		echo $"   - Moving it to: $install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
 		mkdir -p "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
-		mv -f "$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix" "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/" 2>/dev/null
+		dpkg-divert --remove --rename --divert  "$dkms_tree/$module/original_module/$1/$2/${dest_module_name[$count]}$module_suffix" "$install_tree/$1${DEST_MODULE_LOCATION[$count]}/"
 	    else
 		echo $"   - No original module was found for this module on this kernel."
 		echo $"   - Use the dkms install command to reinstall any previous module version."


More information about the Pkg-dkms-maint mailing list