Skip to content

Commit

Permalink
treewide: Invoke bash with --noediting
Browse files Browse the repository at this point in the history
With GNU readline 8.1, bracketed paste is enabled by default which tbot
cannot currently handle.  This change showed that we still have some
places in tbot where readline was (unintentionally) not disabled.  Fix
this by adding `--noediting` to each shell invocation to ensure we do
not have the GNU readline active.

Ref: #51
Signed-off-by: Harald Seiler <hws@denx.de>
  • Loading branch information
Rahix committed Jun 7, 2021
1 parent fed0919 commit ec0f6c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions selftest/testmachines.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ def subshell(
# Patch the shell invocation command if no args are given because we're
# not using real `ash` here ...
if len(args) == 0:
args = ("bash", "--posix", "--norc", "--noprofile")
args = ("bash", "--posix", "--norc", "--noprofile", "--noediting")

with super().subshell(*args):
yield self

def connect(self, mach: linux.LinuxShell) -> channel.Channel:
# Make sure the terminal is wide enough to not cause breaks.
mach.exec0("stty", "cols", "1024")
return mach.open_channel("bash", "--posix", "--norc", "--noprofile")
return mach.open_channel(
"bash", "--posix", "--norc", "--noprofile", "--noediting"
)


class MocksshServer(
Expand Down
2 changes: 1 addition & 1 deletion tbot/machine/channel/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self) -> None:
self.pty_master, pty_slave = pty.openpty()

self.p = subprocess.Popen(
["bash", "--norc", "--noprofile", "-i"],
["bash", "--norc", "--noprofile", "--noediting", "-i"],
stdin=pty_slave,
stdout=pty_slave,
stderr=pty_slave,
Expand Down
2 changes: 1 addition & 1 deletion tbot/tc/selftest/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def selftest_machine_shell(m: typing.Union[linux.LinuxShell, board.UBootShell])

assert content == "Hello World\nLorem ipsum\n", repr(content)

with m.run("bash", "--norc", "--noprofile") as bs:
with m.run("bash", "--norc", "--noprofile", "--noediting") as bs:
bs.sendline("exit")
bs.terminate0()

Expand Down

0 comments on commit ec0f6c6

Please sign in to comment.