public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] boot parameters: quoting of environment variables revisited
@ 2004-10-19 22:23 Werner Almesberger
  2004-10-20  1:04 ` Andrew Morton
  2004-10-20  6:21 ` Rusty Russell
  0 siblings, 2 replies; 11+ messages in thread
From: Werner Almesberger @ 2004-10-19 22:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton

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@almesberger.net>

--- 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@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-10-22  1:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-19 22:23 [PATCH] boot parameters: quoting of environment variables revisited Werner Almesberger
2004-10-20  1:04 ` Andrew Morton
2004-10-20  1:47   ` Werner Almesberger
2004-10-20  6:21 ` Rusty Russell
2004-10-20  7:16   ` [PATCH] boot parameters: quoting of environment variablesrevisited Len Brown
2004-10-20  7:35     ` Rusty Russell
2004-10-20  7:53       ` [PATCH] boot parameters: quoting of environmentvariablesrevisited Len Brown
2004-10-20  8:03         ` Rusty Russell
2004-10-22  1:01         ` Rusty Russell
2004-10-20  9:04     ` [PATCH] boot parameters: quoting of environment variablesrevisited Werner Almesberger
2004-10-20  9:27   ` [PATCH] boot parameters: quoting of environment variables revisited Werner Almesberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox