public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Anshul Dalal <anshuld@ti.com>
Cc: <u-boot@lists.denx.de>,
	 Francis Laniel <francis.laniel@amarulasolutions.com>,
	 Harald Seiler <hws@denx.de>,  Tom Rini <trini@konsulko.com>
Subject: Re: command negation in modern hush parser
Date: Mon, 16 Mar 2026 09:22:47 +0100	[thread overview]
Message-ID: <87h5qgp4iw.fsf@prevas.dk> (raw)
In-Reply-To: <DH0LLC5YYZBT.150TWGKWHGJIE@ti.com> (Anshul Dalal's message of "Thu, 12 Mar 2026 12:12:38 +0530")

On Thu, Mar 12 2026, Anshul Dalal <anshuld@ti.com> wrote:

> On Wed Mar 11, 2026 at 5:31 PM IST, Rasmus Villemoes wrote:
>>
>> => cli set modern
>>
>> => ! false
>> => echo $?
>> 1
>> => ! true
>> => echo $?
>> 0
>
> I was able to reproduce the issue and it looks like we might have missed
> reverting the return code based on pi->pi_inverted inside run_pipe in
> the one of the cases. The following diff fixes the issue for me:
>
> 	diff --git a/common/cli_hush_upstream.c b/common/cli_hush_upstream.c
> 	index 748ef60ac90..c01ba00e475 100644
> 	--- a/common/cli_hush_upstream.c
> 	+++ b/common/cli_hush_upstream.c
> 	@@ -10377,6 +10377,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
> 		debug_printf_exec("run_pipe return -1 (%u children started)\n", pi->alive_cmds);
> 		return -1;
> 	 #else /* __U_BOOT__ */
> 	+       IF_HAS_KEYWORDS(if (pi->pi_inverted) rcode = !rcode;)
> 		debug_printf_exec("run_pipe return %d\n", rcode);
> 		return rcode;
> 	 #endif /* __U_BOOT__ */

Indeed, that seems to fix it, at least for the tests I could think of
throwing at it.

Will you send a proper patch?

Thanks,
Rasmus

  reply	other threads:[~2026-03-16  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 12:01 command negation in modern hush parser Rasmus Villemoes
2026-03-12  6:42 ` Anshul Dalal
2026-03-16  8:22   ` Rasmus Villemoes [this message]
2026-03-16  9:25     ` Anshul Dalal

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=87h5qgp4iw.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=anshuld@ti.com \
    --cc=francis.laniel@amarulasolutions.com \
    --cc=hws@denx.de \
    --cc=trini@konsulko.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