public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Disable bracketed paste mode in GDB tests
@ 2021-01-18 19:20 Tom Tromey
  2021-01-18 19:26 ` Andreas Schwab
  2021-01-23 15:43 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2021-01-18 19:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I have a patch to import GNU readline 8.1 into GDB.  However, when
running the tests, there were a number of failures due to "bracketed
paste mode".  This is a terminal feature that readline 8.1 enables by
default.

The simplest way to work around this was to always make a ".inputrc"
for GDB tests that will tell readline to disable brackted paste mode.

gdb/testsuite/ChangeLog
2021-01-18  Tom Tromey  <tom@tromey.com>

	* lib/gdb.exp (default_gdb_init): Set INPUTRC to a cached file.
---
 gdb/testsuite/ChangeLog   |  4 ++++
 gdb/testsuite/lib/gdb.exp | 13 ++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ae24fe2f49c..7b0420d8f00 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5265,13 +5265,12 @@ proc default_gdb_init { test_file_name } {
     setenv LC_CTYPE C
     setenv LANG C
 
-    # Don't let a .inputrc file or an existing setting of INPUTRC mess up
-    # the test results.  Even if /dev/null doesn't exist on the particular
-    # platform, the readline library will use the default setting just by
-    # failing to open the file.  OTOH, opening /dev/null successfully will
-    # also result in the default settings being used since nothing will be
-    # read from this file.
-    setenv INPUTRC "/dev/null"
+    # Don't let a .inputrc file or an existing setting of INPUTRC mess
+    # up the test results.  Certain tests (style tests and TUI tests)
+    # want to set the terminal to a non-"dumb" value, and for those we
+    # want to disable bracketed paste mode.  It seems harmless to
+    # simply always do this.
+    setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"]
 
     # This disables style output, which would interfere with many
     # tests.
-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 19:20 [PATCH] Disable bracketed paste mode in GDB tests Tom Tromey
@ 2021-01-18 19:26 ` Andreas Schwab
  2021-01-18 19:35   ` Tom Tromey
  2021-01-23 15:43 ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2021-01-18 19:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Jan 18 2021, Tom Tromey wrote:

> +    # Don't let a .inputrc file or an existing setting of INPUTRC mess
> +    # up the test results.  Certain tests (style tests and TUI tests)
> +    # want to set the terminal to a non-"dumb" value, and for those we
> +    # want to disable bracketed paste mode.  It seems harmless to
> +    # simply always do this.
> +    setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"]

Note that readline will barf if it finds an unknown variable in INPUTRC.
When using --with-system-readline and the system readline is < 8.1 this
will fail.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 19:26 ` Andreas Schwab
@ 2021-01-18 19:35   ` Tom Tromey
  2021-01-18 19:52     ` Tom Tromey
  2021-01-18 20:01     ` Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2021-01-18 19:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Tom Tromey, gdb-patches

>>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:

Andreas> Note that readline will barf if it finds an unknown variable in INPUTRC.
Andreas> When using --with-system-readline and the system readline is < 8.1 this
Andreas> will fail.

I tested this scenario before submitting, by changing the line to read
"set hi-bob off", and it still passed my smoke test.  There's no mention
of "hi-bob" in the gdb.log.

If you can tell me how to detect the failure, I'll see what I can do.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 19:35   ` Tom Tromey
@ 2021-01-18 19:52     ` Tom Tromey
  2021-01-18 20:01     ` Andreas Schwab
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2021-01-18 19:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andreas Schwab, gdb-patches

Tom> If you can tell me how to detect the failure, I'll see what I can do.

I just tried wrapping the setting like

$if version >= 8.0
set ...
$endif

... but bizarrely, this did not work with readline 8.1, while the
version without the $if did.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 19:35   ` Tom Tromey
  2021-01-18 19:52     ` Tom Tromey
@ 2021-01-18 20:01     ` Andreas Schwab
  2021-01-21 23:24       ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2021-01-18 20:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Jan 18 2021, Tom Tromey wrote:

> If you can tell me how to detect the failure, I'll see what I can do.

Perhaps it's specific to bash.

$ INPUTRC=/tmp/inputrc bash
readline: /tmp/inputrc: line 1: foo: unknown variable name

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 20:01     ` Andreas Schwab
@ 2021-01-21 23:24       ` Tom Tromey
  2021-01-22 15:18         ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2021-01-21 23:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Tom Tromey, gdb-patches

Andreas> Perhaps it's specific to bash.

Andreas> $ INPUTRC=/tmp/inputrc bash
Andreas> readline: /tmp/inputrc: line 1: foo: unknown variable name

Hmm.  I do see this with the system gdb:

    readline: /tmp/INP: line 1: foo: unknown variable name

I wonder why I don't see it with the gdb I built.
Maybe I need to try a system readline build.

Also I am not sure about the $if solution, given that readline 8.1 has a
bug here.  We can fix that in-tree, but that fix won't work for a system
readline build.  Ugh.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-21 23:24       ` Tom Tromey
@ 2021-01-22 15:18         ` Tom Tromey
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2021-01-22 15:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andreas Schwab, gdb-patches

Tom> Hmm.  I do see this with the system gdb:
Tom>     readline: /tmp/INP: line 1: foo: unknown variable name

I see it now with my built gdb as well.
I don't know why I did not see it before :(

Tom> Also I am not sure about the $if solution, given that readline 8.1 has a
Tom> bug here.  We can fix that in-tree, but that fix won't work for a system
Tom> readline build.  Ugh.

Using the $if-less patch will cause a warning, but apparently this does
not negatively affect the tests.

On the other hand, the patch using $if will cause many failures if gdb
is linked against a version of Readline 8.1 with the $if bug.

So, I think the best approach is to use the variant without the $if.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Disable bracketed paste mode in GDB tests
  2021-01-18 19:20 [PATCH] Disable bracketed paste mode in GDB tests Tom Tromey
  2021-01-18 19:26 ` Andreas Schwab
@ 2021-01-23 15:43 ` Tom Tromey
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2021-01-23 15:43 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> gdb/testsuite/ChangeLog
Tom> 2021-01-18  Tom Tromey  <tom@tromey.com>

Tom> 	* lib/gdb.exp (default_gdb_init): Set INPUTRC to a cached file.

I've updated the comment to reflect the findings from this thread, and I
am going to check it in.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-23 15:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 19:20 [PATCH] Disable bracketed paste mode in GDB tests Tom Tromey
2021-01-18 19:26 ` Andreas Schwab
2021-01-18 19:35   ` Tom Tromey
2021-01-18 19:52     ` Tom Tromey
2021-01-18 20:01     ` Andreas Schwab
2021-01-21 23:24       ` Tom Tromey
2021-01-22 15:18         ` Tom Tromey
2021-01-23 15:43 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).