mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] test: py: add xfail test for surprising hush quoting behavior
Date: Mon, 26 Jan 2026 10:19:46 +0100	[thread overview]
Message-ID: <20260126091952.4009991-1-a.fatoum@pengutronix.de> (raw)

When mixing both double quotes and single quotes in a command and
passing it through labgrid, the quoting labgrid does on top will exceed
barebox hush's abilities. Fixing this is likely an involved matter, but
let's add a test that's expected to fail, so this can be revisited in
the future.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/py/test_shell.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/py/test_shell.py b/test/py/test_shell.py
index 6591b3097be3..50ae497fc6c3 100644
--- a/test/py/test_shell.py
+++ b/test/py/test_shell.py
@@ -2,6 +2,7 @@
 
 from .helper import skip_disabled
 import json
+import pytest
 
 
 def test_barebox_true(barebox, barebox_config):
@@ -18,6 +19,19 @@ def test_barebox_false(barebox, barebox_config):
     assert returncode == 1
 
 
+@pytest.mark.xfail(reason="barebox Hush quote handling is bogus")
+def test_shell_quoting(barebox):
+    # Labgrid will write this command to a file and execute that and add
+    # extra quoting in the process, which we want hush to be able to handle
+    # Below is equivalent to
+    # echo > testcmd 'echo > /tmp/script '"'"'var="A B"'"'"''; sh testcmd
+    barebox.console.sendline(r"""echo -o testcmd 'echo -o /tmp/script '"'"'var="A B"'"'"''; sh testcmd""")
+    barebox._await_prompt()
+    assert barebox.run_check('cat testcmd') == [r"""echo -o /tmp/script 'var="A B"'"""]
+    assert barebox.run_check('cat /tmp/script') == [r'''var="A B"''']
+    assert barebox.run_check('source /tmp/script && echo "$var"') == "A B"
+
+
 def test_barebox_md5sum(barebox, barebox_config):
     skip_disabled(barebox_config, "CONFIG_CMD_MD5SUM", "CONFIG_CMD_ECHO")
 
-- 
2.47.3




             reply	other threads:[~2026-01-26  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26  9:19 Ahmad Fatoum [this message]
2026-01-27  8:08 ` Ahmad Fatoum

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=20260126091952.4009991-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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