Re: modprobe bug for aliases with regular expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 14, 2006 at 02:59:30PM +1000, Rusty Russell wrote:
> On Thu, 2006-04-13 at 16:35 -0700, Greg KH wrote:
> > Recently it's been pointed out to me that the modprobe functionality
> > with aliases doesn't quite work properly for some USB modules.
> 
> Sorry, my bad.  I got a patch for this a while ago from Sam Morris.
> Originally noone was using ranges in [].
> 
> This is fixed in 3.3-pre1.  I should release 3.3 proper sometime this
> weekend.

So, the patch that fixes it is the patch below? (needed for distros that
don't want to rev the whole package...)

thanks,

greg k-h


diff -Naur module-init-tools-3.2.2/modprobe.c module-init-tools-3.3-pre1/modprobe.c
--- module-init-tools-3.2.2/modprobe.c	2005-12-01 15:42:09.000000000 -0800
+++ module-init-tools-3.3-pre1/modprobe.c	2006-02-04 15:18:07.000000000 -0800
@@ -990,13 +990,27 @@
 	return ret;
 }
 
+/* Careful!  Don't munge - in [ ] as per Debian Bug#350915 */
 static char *underscores(char *string)
 {
 	if (string) {
 		unsigned int i;
-		for (i = 0; string[i]; i++)
-			if (string[i] == '-')
-				string[i] = '_';
+		int inbracket = 0;
+		for (i = 0; string[i]; i++) {
+			switch (string[i]) {
+			case '[':
+				inbracket++;
+				break;
+			case ']':
+				inbracket--;
+				break;
+			case '-':
+				if (!inbracket)
+					string[i] = '_';
+			}
+		}
+		if (inbracket)
+			warn("Unmatched bracket in %s\n", string);
 	}
 	return string;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux