public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Domenico Andreoli <cavokz@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix handling of some broken test expressions
Date: Thu, 15 Nov 2012 15:36:09 +0100	[thread overview]
Message-ID: <20121115143609.GA3957@glitch> (raw)

Observed incorrect bahavior (some debug traces are enabled):

U-Boot# test = yes
test(3): '=' 'yes': returns 0
U-Boot# test yes =
test(3): 'yes' '=': returns 0

This means that any "if test" with such broken expressions (maybe due to
an empty variable) in incorrectly evaluated as true.

Signed-off-by: Domenico Andreoli <cavokz@gmail.com>
---
 common/cmd_test.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cmd_test.c b/common/cmd_test.c
index d4ec186..dedda30 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -64,7 +64,7 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			adv = 3;
 
 		if (left < adv) {
-			expr = 1;
+			expr = 0;
 			break;
 		}
 
-- 
1.7.10.4

                 reply	other threads:[~2012-11-15 14:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20121115143609.GA3957@glitch \
    --to=cavokz@gmail.com \
    --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