Skip to contentSkip to conversation

Fix negation on modern hush shell

PATCH In review Anshul Dalal 2 participants 3 messages Jul 28 – Aug 11

lore
Share & tools
lore
#0 lore raw

cover Fix negation on modern hush shell

This patch series fixes the negation on modern hush shell and adds a sandbox test for the same.

---
Anshul Dalal (2):
cli: hush_modern: fix negation during run_pipe
test: hush: Test hush negation

 common/cli_hush_upstream.c |  1 +
 test/hush/Makefile         |  3 +++
 test/hush/modern.c         | 30 ++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+)

---
base-commit: 5c215cb75c3723cbf77c36cbac3e60b001721c79
change-id: 20260714-negation_fix-2ff538762dd3

Best regards,

Signature · 1 line
Anshul Dalal <[email protected]>
#1 lore raw

PATCH 1/2 cli: hush_modern: fix negation during run_pipe

The negation rule was not being applied when run_pipe was executed leading to '! command' not actually negating the return code when using modern shell.

=> cli set modern
=> ! false
=> echo $?
<Prints 1 before this patch with the expected output being 0>

---
 common/cli_hush_upstream.c | 1 +
 1 file changed, 1 insertion(+)
common/cli_hush_upstream.c +1 -0
index 748ef60ac90b..c01ba00e4754 100644
@@ -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__ */
Signature · 1 line
2.55.0
#2 lore raw
In reply to Anshul Dalal
Quoted 4 lines · Anshul Dalal

This patch series fixes the negation on modern hush shell and adds a sandbox test for the same.

Applied to u-boot/next, thanks!

[1/2] cli: hush_modern: fix negation during run_pipe

      commit: 222563887217c9465edab460f9c52011566d959e
Signature · 1 line
Tom