From: Rabin Vincent <rabin@rab.in>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] hush: add some tests for quoting
Date: Wed, 5 Nov 2014 21:11:58 +0100 [thread overview]
Message-ID: <20141105201158.GB28554@debian> (raw)
In-Reply-To: <CAPnjgZ1nNdZXLtmLySqywx92Dq7Fk4W1x9PriHcU05C-Xx4G4Q@mail.gmail.com>
On Sat, Nov 01, 2014 at 09:12:37AM -0600, Simon Glass wrote:
> On 29 October 2014 16:21, Rabin Vincent <rabin@rab.in> wrote:
> > + assert(run_command("setenv ut_var '\"'; setenv ut_var2 \"${ut_var}\"", 0) == 0);
> > + assert(!strcmp(getenv("ut_var2"), "\""));
> > +
> > + assert(run_command("setenv ut_catcat setenv ut_catout\\;setenv ut_catX setenv ut_catout \\\\\\\\\\\\\\\"\\$\\$ut_catin\\\\\\\\\\\\\\\" \\; run ut_catX", 0) == 0);
> > + assert(run_command("setenv ut_pointer '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20'", 0) == 0);
>
> Can we reduce this down to 3-4 numbers for easier maintenance? Or do
> the 20 numbers buy us something?
After 14 arguments, the quotes around them become necessary, so having
more than 14 ensures we test that the quotes are still there:
=> setenv x 1 2 3 4 5 6 7 8 9 10 11 12 13
=> setenv x 1 2 3 4 5 6 7 8 9 10 11 12 13 14
=> setenv x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
setenv - set environment variables
Usage:
setenv [-f] name value ...
- [forcibly] set environment variable 'name' to 'value ...'
setenv [-f] name
- [forcibly] delete environment variable 'name'
=> setenv x '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
=>
> Also did you test this with the simple cli parser too?
No, I didn't realize that these tests they would get run without hush.
I tried them out and they fail with the simple parser, as do the tests
with the empty strings in the third patch. What do you suggest? Drop
these new tests, or move them inside the ifdef HUSH?
next prev parent reply other threads:[~2014-11-05 20:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 22:21 [U-Boot] [PATCH 1/6] dlmalloc: ensure gd is set for early alloc Rabin Vincent
2014-10-29 22:21 ` [U-Boot] [PATCH 2/6] sandbox: init cli for -c Rabin Vincent
2014-11-01 15:11 ` Simon Glass
2014-11-10 21:26 ` [U-Boot] [U-Boot,2/6] " Tom Rini
2014-10-29 22:21 ` [U-Boot] [PATCH 3/6] hush: return consistent codes from run_command() Rabin Vincent
2014-11-01 15:11 ` Simon Glass
2014-11-10 21:26 ` [U-Boot] [U-Boot, " Tom Rini
2014-10-29 22:21 ` [U-Boot] [PATCH 4/6] hush: fix segfault on syntax error Rabin Vincent
2014-11-01 15:11 ` Simon Glass
2014-11-10 21:27 ` [U-Boot] [U-Boot,4/6] " Tom Rini
2014-10-29 22:21 ` [U-Boot] [PATCH 5/6] hush: make run_command() return an error on parsing failure Rabin Vincent
2014-11-01 15:12 ` Simon Glass
2014-11-10 21:27 ` [U-Boot] [U-Boot, " Tom Rini
2014-10-29 22:21 ` [U-Boot] [PATCH 6/6] hush: add some tests for quoting Rabin Vincent
2014-11-01 15:12 ` Simon Glass
2014-11-05 20:11 ` Rabin Vincent [this message]
2014-11-06 19:26 ` Simon Glass
2014-11-01 15:11 ` [U-Boot] [PATCH 1/6] dlmalloc: ensure gd is set for early alloc Simon Glass
2014-11-05 19:37 ` Rabin Vincent
2014-11-10 21:26 ` [U-Boot] [U-Boot, " Tom Rini
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=20141105201158.GB28554@debian \
--to=rabin@rab.in \
--cc=u-boot@lists.denx.de \
/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