command negation in modern hush parser

Rasmus Villemoes ravi at prevas.dk
Mon Mar 16 09:22:47 CET 2026


On Thu, Mar 12 2026, Anshul Dalal <anshuld at 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


More information about the U-Boot mailing list