bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regression - extra terminal escape codes emitted


From: Joe Nahmias
Subject: Regression - extra terminal escape codes emitted
Date: Mon, 2 Nov 2020 12:29:38 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

Hello bash team,

I've noticed a regression in one of my test suites for a program using the
python pexpect library, after upgrading from 5.0.3(1)-release to
5.1.0(1)-rc1. Here's a minimal test case (in python) I've created:

#!/usr/bin/python3

import os
import pexpect

ps1 = "MYspECIalpROmpt: "
env = {
    "HOME": os.environ["HOME"],
    "LANG": "en_US.UTF-8",
    "LOGNAME": os.environ["LOGNAME"],
    "PS1": ps1,
    "PATH": "/usr/local/bin:/usr/bin:/bin",
    "TERM": "dumb",
    "USER": os.environ["USER"],
}
expects = [pexpect.TIMEOUT, "(\r\n)?" + ps1]

child = pexpect.spawn("bash --norc", env=env, echo=False)
pos = child.expect(expects, timeout=1)
child.sendline('echo $BASH_VERSION')
pos = child.expect(expects, timeout=1)
if pos:
    print(f'Got BASH_VERSION="{child.before.decode("utf-8")}".')
else:
    print("expect() timed-out!")
print(f"Debug info:\n{str(child)}")

child.sendline("exit")
child.close()
# EOF


When running on a machine with bash 5.1.0(1)-rc1 installed, I get:
$ ./test.py
5.1.0(1)-rc1SION="
".
Debug info:
<pexpect.pty_spawn.spawn object at 0x7f547c138a60>
command: /usr/bin/bash
args: ['/usr/bin/bash', '--norc']
buffer (last 100 chars): b''
before (last 100 chars): b'\x1b[?2004l\r5.1.0(1)-rc1\r\n\x1b[?2004h'
after: b'MYspECIalpROmpt: '
match: <re.Match object; span=(31, 48), match=b'MYspECIalpROmpt: '>
match_index: 1
exitstatus: None
flag_eof: False
pid: 2018364
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1


After I downgrade to bash 5.0.18(1)-release, I get:
$ ./test.py
Got BASH_VERSION="5.0.18(1)-release".
Debug info:
<pexpect.pty_spawn.spawn object at 0x7f283998ea60>
command: /usr/bin/bash
args: ['/usr/bin/bash', '--norc']
buffer (last 100 chars): b''
before (last 100 chars): b'5.0.18(1)-release'
after: b'\r\nMYspECIalpROmpt: '
match: <re.Match object; span=(17, 36), match=b'\r\nMYspECIalpROmpt: '>
match_index: 1
exitstatus: None
flag_eof: False
pid: 2019518
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1


Please let me know if you need any additional information.
--Joe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]