[U-Boot] hashtable lib and escaping

Mats Kärrman Mats.Karrman at tritech.se
Fri Nov 2 08:30:15 CET 2012


Thanks, but...
If not correct, then what is this supposed to mean (common/main.c :: builtin_run_command()):

		/*
		 * Find separator, or string end
		 * Allow simple escape of ';' by writing "\;"
		 */

This does not indicate "by chance", or was it something else that was not correct?
BR // Mats

> From: Wolfgang Denk [wd at denx.de]
> Sent: Thursday, November 01, 2012 9:00 PM
> To: Mats Kärrman
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] hashtable lib and escaping
> 
> Dear Mats Kärrman,
> 
> In message <ED3E0BCACD909541BA94A34C4A164D4C425CEE7A at post.tritech.se> you wrote:
> >
> > I used to have a working setup using U-Boot 2009.03 before upgrading to U-Boot 2012.07. The problem I'm facing is related to the escaping policies of lib/hashtable.c.
> >
> > What I did before was for example having something like this in my default environment:
> >
> > bootcmd=run first_boot
> > first_boot=setenv bootcmd my_select\;run ubi_boot;saveenv;boot
> 
> THis syntax has never been correct.  If it ever worked, than only by
> chance (read: because of incorrect/imperfect code).
> 
> > With the escape parsing of himport_r(), the '\' is simply dropped and it is no longer possible to escape ';' so the "run ubi_boot" is immediately executed and nothing is saved... The function header mentions the possibility for multi-line values but thi
> > s should not come at the cost of not being able to escape ';'.
> 
> You have to be casreful here and keep in mind that (de-) escaping will
> take place in a different places: himport() (resp. setenv()) is only
> one part of this story - the other part is when you will actually pass
> this string to the command processor (the shell).
> 
> See here:
> 
>         => setenv foo 'echo part one\;echo part two' ; print foo ; run foo
>         foo=echo part one;echo part two
>         part one
>         part two
>         => setenv foo 'echo part one\\;echo part two' ; print foo ; run foo
>         foo=echo part one\;echo part two
>         part one;echo part two
>         =>
> 
> 
> 
> Best regards,
> 
> Wolfgang Denk
> 
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> "No matter where you go, there you are..."          - Buckaroo Banzai
> 


More information about the U-Boot mailing list