[issue42819] readline 8.1 bracketed paste

STINNER Victor report at bugs.python.org
Mon Feb 15 04:29:32 EST 2021


STINNER Victor <vstinner at python.org> added the comment:

I didn't know "bracketed paste mode". It seems like a protocol between a terminal and the user to add markers before/after a pasted text.
https://cirw.in/blog/bracketed-paste

"""
In summary:

1. Enable bracketed paste: printf "\e[?2004h"
2. Wait for paste to start: you’ll see \e[200~ on STDIN.
3. Wait for paste to stop: you’ll see \e[201~ on STDIN.
4. Disable bracketed paste: printf "\e[?2004l"
"""

I understand that this mode prevents to run arbitrary command when pasting blindly an untrusted command copied from a webpage, like this example:
https://thejh.net/misc/website-terminal-copy-paste

It can be enabled explicitly by adding "set enable-bracketed-paste" on to your ~/.inputrc configuration file.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42819>
_______________________________________


More information about the Python-bugs-list mailing list