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

Bug#273191: no longer seems to support kernel command line variable values with spaces in their name



On Sat, 2004-09-25 at 05:31, Christoph Hellwig wrote:
> On Thu, Sep 23, 2004 at 03:40:18PM +0200, Joey Hess wrote:
> > Package: kernel
> > Version: 2.6.8
> > Severity: normal
> > 
> > The 2.4 kernel supports parameters passed on the kernel command line of
> > the form COUNTRY="United States"; it understands the use of quotes
> > around the value with a space in it, and sets the environment variable
> > fine. It seems this support was dropped in the 2.6 kernel.
> 
> Rusty, was this change intentional?

Nope.  Interesting to find someone actually uses that odd "turn option
into env var" stuff.

Name: Restore quotes around environment variables
Status: Tested on 2.6.9-rc2-bk13
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

As noticed by Joey Hess (and thanks for Christoph for forwarding it):
if we decide that a command line option is not really for the kernel,
we turn it into an init command line arg or env var.  In the env var
case, we need to restore the quotes as well (which were eaten up by
the parsing engine).

This is a hack, sure, but randomly turning parameters into env vars
isn't exactly clean either.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.9-rc2-bk13/init/main.c working-2.6.9-rc2-bk13-qemu-page-offset/init/main.c
--- linux-2.6.9-rc2-bk13/init/main.c	2004-09-28 16:22:42.000000000 +1000
+++ working-2.6.9-rc2-bk13-qemu-page-offset/init/main.c	2004-09-28 18:41:07.000000000 +1000
@@ -286,8 +286,18 @@ __setup("quiet", quiet_kernel);
 static int __init unknown_bootoption(char *param, char *val)
 {
 	/* Change NUL term back to "=", to make "param" the whole string. */
-	if (val)
-		val[-1] = '=';
+	if (val) {
+		/* param=val or param="val"? */
+		if (val == param+strlen(param)+1)
+			val[-1] = '=';
+		else if (val == param+strlen(param)+2) {
+			val[-1] = '"';
+			val[-2] = '=';
+			val[strlen(val)] = '"';
+		} else
+			BUG();
+		
+	}
 
 	/* Handle obsolete-style parameters */
 	if (obsolete_checksetup(param))

-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell




Reply to: