[PATCH] boot parameters: quoting of environment variables revisited

From: Werner Almesberger
Date: Tue Oct 19 2004 - 17:39:49 EST


When passing boot parameters, they can be quoted as follows:
param="value"

Unfortunately, when passing environment variables this way, the
quoting causes confusion: in 2.6.7 (etc.), only the variable name
was placed in the environment, which caused it to be ignored.
I've sent a patch that adjusted the name, but this patch was
dropped. Instead, apparently a different fix was attempted in
2.6.9, but this now yields param="value in the environment (note
the embeded double quote), which isn't much better.

I've attached a patch for 2.6.9 that fixes this. This time, I'm
shifting the value. Maybe you like it better this way :-)

- Werner

---------------------------------- cut here -----------------------------------

Signed-off-by: Werner Almesberger <werner@xxxxxxxxxxxxxxx>

--- linux-2.6.9/init/main.c.orig Tue Oct 19 19:07:45 2004
+++ linux-2.6.9/init/main.c Tue Oct 19 19:11:05 2004
@@ -310,6 +310,13 @@
if (val) {
/* Environment option */
unsigned int i;
+
+ /* If the value was quoted, shift it. */
+ if (val[-1] == '"') {
+ memmove(val-1,val,strlen(val)+1);
+ val--;
+ }
+
for (i = 0; envp_init[i]; i++) {
if (i == MAX_INIT_ENVS) {
panic_later = "Too many boot env vars at `%s'";

--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina werner@xxxxxxxxxxxxxxx /
/_http://www.almesberger.net/____________________________________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/