Linux Tegra architecture development
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber-l3A5Bk7waGM@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [flasher PATCH 2/2] Wrap any env var settings in quotes
Date: Wed, 02 Jul 2014 20:42:14 +0200	[thread overview]
Message-ID: <53B45286.9050408@suse.de> (raw)
In-Reply-To: <1404322363-11580-2-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

Hi,

Am 02.07.2014 19:32, schrieb Stephen Warren:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  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

  parent reply	other threads:[~2014-07-02 18:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 17:32 [flasher PATCH 1/2] Switch flasher script to subprocess Stephen Warren
     [not found] ` <1404322363-11580-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-07-02 17:32   ` [flasher PATCH 2/2] Wrap any env var settings in quotes Stephen Warren
     [not found]     ` <1404322363-11580-2-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-07-02 18:42       ` Andreas Färber [this message]
     [not found]         ` <53B45286.9050408-l3A5Bk7waGM@public.gmane.org>
2014-07-02 18:46           ` Stephen Warren
2014-07-02 23:18   ` [flasher PATCH 1/2] Switch flasher script to subprocess Stephen Warren
     [not found]     ` <CA+G9XgdAAMttS66oscdY15jUns+ojOJ4-ny0eRfFYO6PXBNXCg@mail.gmail.com>
     [not found]       ` <CA+G9XgdAAMttS66oscdY15jUns+ojOJ4-ny0eRfFYO6PXBNXCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-21 15:42         ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B45286.9050408@suse.de \
    --to=afaerber-l3a5bk7wagm@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox