<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/common/cli_hush.c, branch v2015.10</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>Revert "hush: fix segfault on syntax error"</title>
<updated>2014-11-24T17:06:06+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2014-11-21T22:05:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f3a05c8f944ab2cd832e69a5705708ee7a1797fa'/>
<id>f3a05c8f944ab2cd832e69a5705708ee7a1797fa</id>
<content type='text'>
128059b92 ("hush: fix segfault on syntax error") attempted to fix a
segfault on syntax errors, but it broke Ctrl-C handling, and the
assumption that it made, that rcode could not be -1, is incorrect.
Revert this change.

Reported-by: Stephen Warren &lt;swarren@wwwdotorg.org&gt;
Reported-by: Przemyslaw Marczak &lt;p.marczak@samsung.com&gt;
Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
128059b92 ("hush: fix segfault on syntax error") attempted to fix a
segfault on syntax errors, but it broke Ctrl-C handling, and the
assumption that it made, that rcode could not be -1, is incorrect.
Revert this change.

Reported-by: Stephen Warren &lt;swarren@wwwdotorg.org&gt;
Reported-by: Przemyslaw Marczak &lt;p.marczak@samsung.com&gt;
Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: make run_command() return an error on parsing failure</title>
<updated>2014-11-07T21:27:06+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2014-10-29T22:21:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=2302b3ab85843c9a8dbb3a924030659d87a23349'/>
<id>2302b3ab85843c9a8dbb3a924030659d87a23349</id>
<content type='text'>
run_command() returns success even if the command had a syntax error;
correct this behaviour.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
run_command() returns success even if the command had a syntax error;
correct this behaviour.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: fix segfault on syntax error</title>
<updated>2014-11-07T21:27:06+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2014-10-29T22:21:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=128059b926b3c34bbb364dcacd8d0511ff906be8'/>
<id>128059b926b3c34bbb364dcacd8d0511ff906be8</id>
<content type='text'>
Hush segfaults if it sees a syntax error while attempting to parse a
command:

 $ ./u-boot -c "'"
 ...
 syntax error
 Segmentation fault (core dumped)

This is due to a NULL pointer dereference of in_str-&gt;p in static_peek().
The problem is that the exit condition for the loop in
parse_stream_outer() checks for rcode not being -1, but rcode is only
ever 0 or 1.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
Tested-by: Simon Glass &lt;sjg@chromium.org)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Hush segfaults if it sees a syntax error while attempting to parse a
command:

 $ ./u-boot -c "'"
 ...
 syntax error
 Segmentation fault (core dumped)

This is due to a NULL pointer dereference of in_str-&gt;p in static_peek().
The problem is that the exit condition for the loop in
parse_stream_outer() checks for rcode not being -1, but rcode is only
ever 0 or 1.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
Tested-by: Simon Glass &lt;sjg@chromium.org)
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: return consistent codes from run_command()</title>
<updated>2014-11-07T21:27:06+00:00</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2014-10-29T22:21:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=484408fb5194586b6ba6251f15cbae0c445c3bf5'/>
<id>484408fb5194586b6ba6251f15cbae0c445c3bf5</id>
<content type='text'>
Attempting to run:
 - an empty string
 - a string with just spaces

returns different error codes, 1 for the empty string and 0
for the string with just spaces.  Make both of them return
0 for consistency.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Attempting to run:
 - an empty string
 - a string with just spaces

returns different error codes, 1 for the empty string and 0
for the string with just spaces.  Make both of them return
0 for consistency.

Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Acked-by: Simon Glass &lt;sjg@chromium.org)
</pre>
</div>
</content>
</entry>
<entry>
<title>cli: hush: Adjust 'run' command to run each line of the env var</title>
<updated>2014-10-27T15:03:33+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-10-07T19:59:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=87b6398b46421c5dadacdda6b4be2d9d71588107'/>
<id>87b6398b46421c5dadacdda6b4be2d9d71588107</id>
<content type='text'>
The run command treats each argument an an environment variable. It gets the
value of each variable and executes it as a command. If an environment
variable contains a newline and the hush cli is used, it is supposed to
execute each line one after the other.

Normally a newline signals to hush to exit - this is used in normal command
line entry - after a command is entered we want to return to allow the user
to enter the next one. But environment variables obviously need to execute
to completion.

Add a special case for the execution of environment variables which
continues when a newline is seen, and add a few tests to check this
behaviour.

Note: it's not impossible that this may cause regressions in other areas.
I can't think of a case but with any change of behaviour with limited test
coverage there is always a risk. From what I can tell this behaviour has
been around since at least U-Boot 2011.03, although this pre-dates sandbox
and I have not tested it on real hardware.

Reported-by: Wolfgang Denk &lt;wd@denx.de&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The run command treats each argument an an environment variable. It gets the
value of each variable and executes it as a command. If an environment
variable contains a newline and the hush cli is used, it is supposed to
execute each line one after the other.

Normally a newline signals to hush to exit - this is used in normal command
line entry - after a command is entered we want to return to allow the user
to enter the next one. But environment variables obviously need to execute
to completion.

Add a special case for the execution of environment variables which
continues when a newline is seen, and add a few tests to check this
behaviour.

Note: it's not impossible that this may cause regressions in other areas.
I can't think of a case but with any change of behaviour with limited test
coverage there is always a risk. From what I can tell this behaviour has
been around since at least U-Boot 2011.03, although this pre-dates sandbox
and I have not tested it on real hardware.

Reported-by: Wolfgang Denk &lt;wd@denx.de&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>common/cli_hush.c: remove unnecessary double braces</title>
<updated>2014-06-11T20:27:06+00:00</updated>
<author>
<name>Jeroen Hofstee</name>
<email>jeroen@myspectrum.nl</email>
</author>
<published>2014-06-10T22:28:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=930e4254ec29ea5133c0772d4a3804ba1c59b275'/>
<id>930e4254ec29ea5133c0772d4a3804ba1c59b275</id>
<content type='text'>
Clang interpretes an if condition like  "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.

Simon Glass &lt;sjg@chromium.org&gt;
Signed-off-by: Jeroen Hofstee &lt;jeroen@myspectrum.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clang interpretes an if condition like  "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.

Simon Glass &lt;sjg@chromium.org&gt;
Signed-off-by: Jeroen Hofstee &lt;jeroen@myspectrum.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix hush to give the correct return code for a simple command</title>
<updated>2014-06-05T18:38:38+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-05-30T20:41:50+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=587e1d43e786ad70ce52a47f74b98d785098e378'/>
<id>587e1d43e786ad70ce52a47f74b98d785098e378</id>
<content type='text'>
When a simple command like 'false' is provided, hush should return the
result of that command. However, hush only does this if the
FLAG_EXIT_FROM_LOOP flag is provided. Without this flag, hush will
happily execute the empty string command immediate after 'false' and
then return a success code.

This behaviour does not seem very useful, and requiring the flag also
seems wrong, since it means that hush will execute only the first command
in a sequence.

Add a check for empty string and fall out of the loop in that case. That
at least fixes the simple command case. This is a change in behaviour but
it is unlikely that the old behaviour would be considered correct in any
case.

Reported-by: Stefan Herbrechtsmeier &lt;stefan@herbrechtsmeier.net&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a simple command like 'false' is provided, hush should return the
result of that command. However, hush only does this if the
FLAG_EXIT_FROM_LOOP flag is provided. Without this flag, hush will
happily execute the empty string command immediate after 'false' and
then return a success code.

This behaviour does not seem very useful, and requiring the flag also
seems wrong, since it means that hush will execute only the first command
in a sequence.

Add a check for empty string and fall out of the loop in that case. That
at least fixes the simple command case. This is a change in behaviour but
it is unlikely that the old behaviour would be considered correct in any
case.

Reported-by: Stefan Herbrechtsmeier &lt;stefan@herbrechtsmeier.net&gt;
Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename bootretry functions and remove #ifdefs</title>
<updated>2014-05-29T21:49:00+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-04-11T02:01:31+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=b26440f1fa243396000536028ea00e5e185b6b6a'/>
<id>b26440f1fa243396000536028ea00e5e185b6b6a</id>
<content type='text'>
Add a bootretry_ prefix to these two functions, and remove the need for
the #ifdef around everything (it moves to the Makefile).

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a bootretry_ prefix to these two functions, and remove the need for
the #ifdef around everything (it moves to the Makefile).

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Move bootretry code into bootretry.c and clean up</title>
<updated>2014-05-29T21:48:21+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-04-11T02:01:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0098e179e1afacb3cf595c67a98b8739dc7edcde'/>
<id>0098e179e1afacb3cf595c67a98b8739dc7edcde</id>
<content type='text'>
This code is only used by one board, so it seems a shame to clutter up
the readline code with it. Move it into its own file.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This code is only used by one board, so it seems a shame to clutter up
the readline code with it. Move it into its own file.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add cli_ prefix to readline functions</title>
<updated>2014-05-29T21:45:31+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2014-04-11T02:01:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e1bf824dfd6881f6f633238c275bfa1e5d83c433'/>
<id>e1bf824dfd6881f6f633238c275bfa1e5d83c433</id>
<content type='text'>
This makes it clear where the code resides.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes it clear where the code resides.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
