bug-bash
[Top][All Lists]
Advanced

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

Re: New feature in bash 5.1/readline-8.1 rc1 breaks python-pexpect


From: Chet Ramey
Subject: Re: New feature in bash 5.1/readline-8.1 rc1 breaks python-pexpect
Date: Fri, 16 Oct 2020 09:03:53 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.3.2

On 10/16/20 5:41 AM, Dr. Werner Fink wrote:
> Hi,
> 
> after build rc1 of bash 5.1 as well as readline-8.1 I've set up test
> staging process.  During build the package python-pexpect throws errors
> in its test suite, e.g.
> 
> [  260s] self = <tests.test_async.AsyncTests 
> testMethod=test_async_replwrap_multiline>
> [  260s] 
> [  260s]     def test_async_replwrap_multiline(self):
> [  260s]         bash = replwrap.bash()
> [  260s]         coro = bash.run_command("echo '1 2\n3 4'", async_=True)
> [  260s]         res = run(coro)
> [  260s] >       self.assertEqual(res.strip().splitlines(), ['1 2', '3 4'])
> [  260s] E       AssertionError: Lists differ: ['\x1b[?2004l', 
> '\x1b[?2004h\x1b[?2004l', '1 2', '3 4', '\x1b[?2004h'] != ['1 2', '3 4']
> [  260s] E       
> [  260s] E       First differing element 0:
> [  260s] E       '\x1b[?2004l'
> [  260s] E       '1 2'
> [  260s] E       
> [  260s] E       First list contains 3 additional elements.
> [  260s] E       First extra element 2:
> [  260s] E       '1 2'
> [  260s] E       
> [  260s] E       - ['\x1b[?2004l', '\x1b[?2004h\x1b[?2004l', '1 2', '3 4', 
> '\x1b[?2004h']
> [  260s] E       + ['1 2', '3 4']
> 
> I found this is caused by (_rl_)enable[-_]bracketed[-_]paste as the sequences
> are defined in rlprivate.h
> 
>  #define BRACK_PASTE_INIT  "\033[?2004h"
>  #define BRACK_PASTE_FINI  "\033[?2004l\r"
> 
> indeed it is a nice feature to see highlighted paste content on the 
> interactive
> command line, but why this interferes with tools like pexpect using bash in
> interactive mode?

Yes, bracketed paste is currently enabled by default. I may change that by
the time 5.1 is released.

I don't understand your question about tools like pexpect. If bracketed
paste mode is on, it's on. How is readline supposed to know whether or not
its stdin and stdout are connected to expect? How is the interactive shell
run by pexpect different from one connected to a terminal?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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