Re: [PATCH] boot parameters: quoting of environmentvariablesrevisited

From: Rusty Russell (rusty_at_rustcorp.com.au)
Date: 10/22/04

  • Next message: John W. Linville: "[patch netdev-2.6 2/2] r8169: fix RxVlan bit manipulation"
    To: Len Brown <len.brown@intel.com>
    Date:	Fri, 22 Oct 2004 11:01:39 +1000
    
    

    On Wed, 2004-10-20 at 17:53, Len Brown wrote:
    > On Wed, 2004-10-20 at 03:35, Rusty Russell wrote:
    > > On Wed, 2004-10-20 at 17:16, Len Brown wrote:
    > > > I verified that this new patch doesn't break the
    > > acpi_os_string="Brand X" kernel parameter.

    OK, so this is the patch then. We strip " when we hand to __setup or
    put into the environment.

    Rusty.
    Name: Remove quotes around environment variables
    Status: Booted on 2.6-bk
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

    As noticed by Joey Hess (and thanks for Christoph for forwarding it).
    Also requirements from Werner Almesberger.

    If someone passes 'foo="some value"' the param engine removes the
    quotes and hands 'foo' and 'some value'. The __setup() parameters
    expect a single string, and so we try to regenerate it from the two
    parts. Finally, we try to place it as an environment variable.

    Werner wants quotes stripped out of the environment variable. It
    makes sense to do that for __setup, too (so it sees 'foo=some value'),
    since __setup functions don't usually handle quotes.

    diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .23831-linux-2.6.9-bk3/init/main.c .23831-linux-2.6.9-bk3.updated/init/main.c
    --- .23831-linux-2.6.9-bk3/init/main.c 2004-10-19 14:34:23.000000000 +1000
    +++ .23831-linux-2.6.9-bk3.updated/init/main.c 2004-10-20 14:48:20.000000000 +1000
    @@ -287,8 +287,15 @@ static int __init unknown_bootoption(cha
     {
             /* Change NUL term back to "=", to make "param" the whole string. */
             if (val) {
    - if (val[-1] == '"') val[-2] = '=';
    - else val[-1] = '=';
    + /* param=val or param="val"? */
    + if (val == param+strlen(param)+1)
    + val[-1] = '=';
    + else if (val == param+strlen(param)+2) {
    + val[-2] = '=';
    + memmove(val-1, val, strlen(val)+1);
    + val--;
    + } else
    + BUG();
             }
     
             /* Handle obsolete-style parameters */

    -- 
    Anyone who quotes me in their signature is an idiot -- Rusty Russell
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: John W. Linville: "[patch netdev-2.6 2/2] r8169: fix RxVlan bit manipulation"

    Relevant Pages

    • Re: [PATCH] boot parameters: quoting of environment variables revisited
      ... > I've sent a patch that adjusted the name, ... AFAICT 2.4 didn't remove quotes, but I have no problem with removing ... Remove quotes around environment variables ... Also requirements from Werner Almesberger. ...
      (Linux-Kernel)
    • Re: Text windows size under XP
      ... If you setup your application server to.. ... cannot be run independently of the IDE? ... environment variables and being able to load the ...
      (comp.lang.cobol)
    • Re: Can enviroment variables be used in paths to product files in a VS setup proj
      ... project locations, not environment variables. ... > I have several Visual Studio setup projects that reference product ... > differentiate between a debug and release product files. ...
      (microsoft.public.vsnet.setup)
    • Re: Error 1639 when using double quotes in COMPANYNAME
      ... Are you entering this information in the Office 2007 Customization tool via Setup /Admin or by another method? ... If you're creating properties to paste in using Word, is the autocorrect feature that converts 'straight quotes to smart quotes' ... Invalid command line argument. ...
      (microsoft.public.office.setup)
    • Re: Finding IP adress, sorry it it is wrong section
      ... quotes) - if this works, it sounds as if your PATH environment variable is ... click Environment Variables button, go to the bottom group, and scroll to ... If not, add it, reboot and command line programs should now work properly. ... > As I told you before, the command is ipconfig /all ...
      (microsoft.public.windowsxp.help_and_support)

    Loading