Attached patch fixes the issue.

Thanks,

-Kees

-- 
Kees Cook                                            @debian.org
Description: Prefer any other device name over names in /dev/block/.
Author: Colin Watson <cjwat...@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/341928
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569290

Index: merged/lib/device/dev-cache.c
===================================================================
--- merged.orig/lib/device/dev-cache.c	2009-07-15 13:02:46.000000000 -0700
+++ merged/lib/device/dev-cache.c	2010-02-10 15:57:40.175269708 -0800
@@ -179,6 +179,21 @@
 	 * Built-in rules.
 	 */
 
+	/* Put /dev/block/ names last regardless of path shortness.
+	 * FIXME It would be better if we could do this in the configuration
+	 * file, but the only way to do so with preferred_names is to try to
+	 * enumerate all the possible names we might want to prefer over
+	 * /dev/block/. */
+	m0 = strncmp(path0, "/dev/block/", 11);
+	m1 = strncmp(path1, "/dev/block/", 11);
+
+	if (m0 != m1) {
+		if (m0 == 0)
+			return 1;
+		if (m1 == 0)
+			return 0;
+	}
+
 	/* Return the path with fewer slashes */
 	for (p = path0; p++; p = (const char *) strchr(p, '/'))
 		slash0++;

Reply via email to