Re: [flasher PATCH 2/2] Wrap any env var settings in quotes

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

 



Hi,

Am 02.07.2014 19:32, schrieb Stephen Warren:
> From: Stephen Warren <swarren@xxxxxxxxxx>
> 
> This allows run user to pass the following to the flashing script:

Is "run user" a typo?

> 
>     --env bootcmd 'usb start ; dhcp zImage'
> 
> rather than having to manually escape the commands for U-Boot:
> 
>     --env bootcmd 'usb start \; dhcp zImage'
> 
> (The quoting in both cases is for the shell invoking tegra-uboot-flasher,
> not for U-Boot's command-line. The removed escaping was to work around
> the lack of quoting/escaping when passing the user's command to U-Boot's
> setenv command during flashing.)
> 
> This change will interact badly with the user wanting to use single
> quotes in environment variable values, but hopefully that's less likely,
> and can be fixed later if needed.
> 
> Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
> ---
>  tegra-uboot-flasher | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher
> index c9adba607c69..ed2f2d91d336 100755
> --- a/tegra-uboot-flasher
> +++ b/tegra-uboot-flasher
> @@ -213,7 +213,7 @@ def func_flash():
>              bootcmd += 'setenv board ' + boardname + config['dtbfn-extra'] + ' ; '
>          if args.env:
>              for (var, value) in args.env:
> -                bootcmd += 'setenv %s %s ; ' % (var, value)
> +                bootcmd += 'setenv %s \'%s\' ; ' % (var, value)

Can't you just s/'/\\\'/g on value somehow, i.e. replace literal
single-quote with an escaped backslash, escaped single-quote sequence?

Regards,
Andreas

>          bootcmd += 'saveenv ; '
>          bootcmd += 'echo >>> Flashing OK, rebooting... ; '
>          # To update the bootloader, reset.

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux