Patchwork Avoid readline conflicts in pexpect

login
register
mail settings
Submitter DJ Delorie
Date Feb. 8, 2019, 7:02 p.m.
Message ID <xnlg2qcdcx.fsf@greed.delorie.com>
Download mbox | patch
Permalink /patch/31369/
State New
Headers show

Comments

DJ Delorie - Feb. 8, 2019, 7:02 p.m.
In some cases, sensitive to readline version and the user's
environment, gdb might emit escape codes while run under python's
pexpect (i.e. testing pretty printers).  This patch, suggested
by Jan, helps isolate the test from the user's environment.

Tested on RHEL 7 x86_64 with DTS 7 and EPEL, which is one
magic combination of components that triggers this bug.

2019-02-08  Jan Kratochvil <jan.kratochvil@redhat.com>

	* scripts/test_printers_common.py: Set TERM to a known harmless
	value.
Carlos O'Donell - Feb. 13, 2019, 8:44 p.m.
On 2/8/19 2:02 PM, DJ Delorie wrote:
> In some cases, sensitive to readline version and the user's
> environment, gdb might emit escape codes while run under python's
> pexpect (i.e. testing pretty printers).  This patch, suggested
> by Jan, helps isolate the test from the user's environment.
> 
> Tested on RHEL 7 x86_64 with DTS 7 and EPEL, which is one
> magic combination of components that triggers this bug.
> 
> 2019-02-08  Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> 	* scripts/test_printers_common.py: Set TERM to a known harmless
> 	value.

OK for master.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
> index dada6aadde..b2bd4ba1cc 100644
> --- a/scripts/test_printers_common.py
> +++ b/scripts/test_printers_common.py
> @@ -60,6 +60,10 @@ TIMEOUTFACTOR = os.environ.get('TIMEOUTFACTOR')
>  if TIMEOUTFACTOR:
>      timeout = int(TIMEOUTFACTOR)
>  
> +# Otherwise GDB is run in interactive mode and readline may send escape
> +# sequences confusing output for pexpect.
> +os.environ["TERM"]="dumb"
> +
>  try:
>      # Check the gdb version.
>      version_cmd = '{0} --version'.format(gdb_invocation, timeout=timeout)
>

Patch

diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
index dada6aadde..b2bd4ba1cc 100644
--- a/scripts/test_printers_common.py
+++ b/scripts/test_printers_common.py
@@ -60,6 +60,10 @@  TIMEOUTFACTOR = os.environ.get('TIMEOUTFACTOR')
 if TIMEOUTFACTOR:
     timeout = int(TIMEOUTFACTOR)
 
+# Otherwise GDB is run in interactive mode and readline may send escape
+# sequences confusing output for pexpect.
+os.environ["TERM"]="dumb"
+
 try:
     # Check the gdb version.
     version_cmd = '{0} --version'.format(gdb_invocation, timeout=timeout)