readline 8.1 and bracketed pasting in vtysh
tl;dr readline 8.1 turns on bracketed paste and appears to break multi-line pasting in vtysh Hi - I noticed that on a few of my boxes I can no longer paste a set of commands into vtysh using either FRR 6.x or 7.x. The result was that the lines were treated as a single line and therefore rejected. For example, if I want to create a simple route-map like so: route-map foo permit 5 set as-path prepend 1 2 3 4 end Here's what happened when I first pasted the 3x lines: ====snip==== excalibur(config)# route-map foo permit 5 set as-path prepend 1 2 3 4 end ====snip==== (the pasted text is highlighted in the terminal) After hitting enter vtysh rejects the command because it sees it as a single line (I think): ====snip==== % Unknown command: route-map foo permit 5 set as-path prepend 1 2 3 4 end excalibur(config)# ====snip==== The expected result should look something like this (I manually typed it in): ====snip==== excalibur(config)# route-map foo permit 5 excalibur(config-route-map)# set as-path prepend 1 2 3 4 excalibur(config-route-map)# end excalibur# ====snip==== I dug a little deeper and it looks like this is a result of bracketed paste[0] that has been enabled in the 8.1 release of GNU readline released in Dec of 2020[1]. I confirmed that an older system I have still running readline 8.0 does not have this issue. I think vtysh rejects the command because of the escape characters that are used with bracketed paste. I couldn't find any option to disable bracketed paste in readline itself or vtysh. Shells like Zsh and Bash have options for it in their config files. Does anyone know how to disable bracketed paste in vtysh? Or, is there something else funky going on here? I'm using rxvt-unicode on Linux/X11. I tested this with Terminal.app on Big Sur as well and got the same result. Thanks! - Mark [0] https://cirw.in/blog/bracketed-paste [1] https://lwn.net/Articles/839213/ (see h. in the CHANGES list) -- Mark Kamichoff prox@prolixium.com https://www.prolixium.com/
Thank you for posting this! I thought I was going bonkers with this issue as the route-maps I was entering kept not being able to be found ?!?!? Sure enough, if I start up the telnet interface, I am able to copy and paste my old configs from a 3.x box I want to upgrade. This is on a RELENG_12 FreeBSD box, frr7 from the ports. ---Mike On 2/1/2021 10:27 PM, Mark Kamichoff wrote:
tl;dr readline 8.1 turns on bracketed paste and appears to break multi-line pasting in vtysh
Hi -
I noticed that on a few of my boxes I can no longer paste a set of commands into vtysh using either FRR 6.x or 7.x. The result was that the lines were treated as a single line and therefore rejected. For example, if I want to create a simple route-map like so:
route-map foo permit 5 set as-path prepend 1 2 3 4 end
Here's what happened when I first pasted the 3x lines:
====snip==== excalibur(config)# route-map foo permit 5 set as-path prepend 1 2 3 4 end
====snip====
(the pasted text is highlighted in the terminal)
After hitting enter vtysh rejects the command because it sees it as a single line (I think):
====snip==== % Unknown command: route-map foo permit 5 set as-path prepend 1 2 3 4 end
excalibur(config)# ====snip====
The expected result should look something like this (I manually typed it in):
====snip==== excalibur(config)# route-map foo permit 5 excalibur(config-route-map)# set as-path prepend 1 2 3 4 excalibur(config-route-map)# end excalibur# ====snip====
I dug a little deeper and it looks like this is a result of bracketed paste[0] that has been enabled in the 8.1 release of GNU readline released in Dec of 2020[1]. I confirmed that an older system I have still running readline 8.0 does not have this issue. I think vtysh rejects the command because of the escape characters that are used with bracketed paste.
I couldn't find any option to disable bracketed paste in readline itself or vtysh. Shells like Zsh and Bash have options for it in their config files.
Does anyone know how to disable bracketed paste in vtysh? Or, is there something else funky going on here?
I'm using rxvt-unicode on Linux/X11. I tested this with Terminal.app on Big Sur as well and got the same result.
Thanks!
- Mark
[0] https://cirw.in/blog/bracketed-paste [1] https://lwn.net/Articles/839213/ (see h. in the CHANGES list)
_______________________________________________ frog mailing list frog@lists.frrouting.org https://lists.frrouting.org/listinfo/frog
On 2/1/2021 10:27 PM, Mark Kamichoff wrote:
tl;dr readline 8.1 turns on bracketed paste and appears to break multi-line pasting in vtysh
Actually, it seems more broken than that for me. If I do something simple like 127{testrouter-2021}# vtysh Hello, this is FRRouting (version 7.5). Copyright 1996-2005 Kunihiro Ishiguro, et al. testrouter-2021# sh run Building configuration... Current configuration: ! frr version 7.5 frr defaults traditional hostname testrouter-2021 service integrated-vtysh-config ! line vty ! end testrouter-2021# wr Note: this version of vtysh never writes vtysh.conf Warning: attempting direct configuration write without watchfrr. File permissions and ownership may be incorrect, or write may fail. Building Configuration... Integrated configuration saved to /usr/local/etc/frr/frr.conf [OK] testrouter-2021# conf t testrouter-2021(config)# router bgp 65666 testrouter-2021(config-router)# nei 192.168.1.1 remote-as 65667 testrouter-2021(config-router)# address-family ipv4 unicast testrouter-2021(config-router-af)# nei 192.168.1.1 route-map TESTOUT out The route-map 'TESTOUT' does not exist. testrouter-2021(config-router-af)# exit testrouter-2021(config-router)# exit testrouter-2021(config)# route-map TESTOUT permit 10 testrouter-2021(config-route-map)# set as-path prepend 65666 testrouter-2021(config-route-map)# exit testrouter-2021(config)# router bgp 65666 testrouter-2021(config-router)# address-family ipv4 unicast testrouter-2021(config-router-af)# nei 192.168.1.1 route-map TESTOUT out testrouter-2021# wr Note: this version of vtysh never writes vtysh.conf Warning: attempting direct configuration write without watchfrr. File permissions and ownership may be incorrect, or write may fail. Building Configuration... Integrated configuration saved to /usr/local/etc/frr/frr.conf [OK] testrouter-2021# exit 0{testrouter-2021}# /usr/local/etc/rc.d/frr stop Stopping bgpd. Waiting for PIDS: 6135. Stopping staticd. Waiting for PIDS: 6130. Stopping zebra. Waiting for PIDS: 6125. 0{testrouter-2021}# /usr/local/etc/rc.d/frr start Checking intergrated config... Checking vtysh.conf OK Starting zebra. 2021/02/02 11:48:37 ZEBRA: [EC 4043309111] Disabling MPLS support (no kernel support) Starting staticd. Starting bgpd. Booting for integrated-vtysh-config... The route-map 'TESTOUT' does not exist. 0{testrouter-2021}# 0{testrouter-2021}# vtysh Hello, this is FRRouting (version 7.5). Copyright 1996-2005 Kunihiro Ishiguro, et al. testrouter-2021# sh run Building configuration... Current configuration: ! frr version 7.5 frr defaults traditional hostname testrouter-2021 service integrated-vtysh-config ! router bgp 65666 neighbor 192.168.1.1 remote-as 65667 ! address-family ipv4 unicast neighbor 192.168.1.1 route-map TESTOUT out exit-address-family ! route-map TESTOUT permit 10 set as-path prepend 65666 ! line vty ! end testrouter-2021# 0{testrouter-2021}# pkg info | grep -i readline readline-8.0.4_1 Library for editing command lines as they are typed 0{testrouter-2021}#
On 2/2/2021 11:51 AM, mike tancsa wrote:
On 2/1/2021 10:27 PM, Mark Kamichoff wrote:
tl;dr readline 8.1 turns on bracketed paste and appears to break multi-line pasting in vtysh
Actually, it seems more broken than that for me. If I do something simple like
Starting bgpd. Booting for integrated-vtysh-config... The route-map 'TESTOUT' does not exist. 0{testrouter-2021}#
I recompiled the port with readline 8.1, and its the same behaviour. However, its not 100% clear if this is just a parsing issue at boot or not 0{testrouter-2021}# pkg info | grep -i readline readline-8.1.0 Library for editing command lines as they are typed 0{testrouter-2021}# 0{testrouter-2021}# vtysh Hello, this is FRRouting (version 7.5). Copyright 1996-2005 Kunihiro Ishiguro, et al. testrouter-2021# sh run Building configuration... Current configuration: ! frr version 7.5 frr defaults traditional hostname testrouter-2021 service integrated-vtysh-config ! router bgp 65666 neighbor 192.168.1.1 remote-as 65667 ! address-family ipv4 unicast neighbor 192.168.1.1 route-map TESTOUT out exit-address-family ! route-map TESTOUT permit 10 set as-path prepend 65666 ! line vty ! end testrouter-2021# conf t testrouter-2021(config)# route-map TESTOUT permit 10 testrouter-2021(config-route-map)# set as-path prepend 65666 testrouter-2021# wr Note: this version of vtysh never writes vtysh.conf Warning: attempting direct configuration write without watchfrr. File permissions and ownership may be incorrect, or write may fail. Building Configuration... Integrated configuration saved to /usr/local/etc/frr/frr.conf [OK] testrouter-2021# exit 0{testrouter-2021}# /usr/local/etc/rc.d/frr stop Stopping bgpd. Waiting for PIDS: 42176. Stopping staticd. Waiting for PIDS: 42171. Stopping zebra. Waiting for PIDS: 42166. 0{testrouter-2021}# /usr/local/etc/rc.d/frr start Checking intergrated config... Checking vtysh.conf OK Starting zebra. 2021/02/02 12:02:04 ZEBRA: [EC 4043309111] Disabling MPLS support (no kernel support) Starting staticd. Starting bgpd. Booting for integrated-vtysh-config... The route-map 'TESTOUT' does not exist. 0{testrouter-2021}# vtysh Hello, this is FRRouting (version 7.5). Copyright 1996-2005 Kunihiro Ishiguro, et al. testrouter-2021# show route-map <cr> WORD route-map name TESTOUT testrouter-2021# show route-map TESTOUT ZEBRA: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap BGP: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: as-path prepend 65666 Call clause: Action: Exit routemap testrouter-2021# testrouter-2021# exit 0{testrouter-2021}# /usr/local/etc/rc.d/frr stop Stopping bgpd. Waiting for PIDS: 42238. Stopping staticd. Waiting for PIDS: 42233. Stopping zebra. Waiting for PIDS: 42228. 0{testrouter-2021}# /usr/local/etc/rc.d/frr start Checking intergrated config... Checking vtysh.conf OK Starting zebra. 2021/02/02 12:04:46 ZEBRA: [EC 4043309111] Disabling MPLS support (no kernel support) Starting staticd. Starting bgpd. Booting for integrated-vtysh-config... The route-map 'TESTOUT' does not exist. 0{testrouter-2021}# vtysh Hello, this is FRRouting (version 7.5). Copyright 1996-2005 Kunihiro Ishiguro, et al. testrouter-2021# sh route-map ZEBRA: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap BGP: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: as-path prepend 65666 Call clause: Action: Exit routemap testrouter-2021# sh route-map TESTOUT ZEBRA: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap BGP: route-map: TESTOUT Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: as-path prepend 65666 Call clause: Action: Exit routemap testrouter-2021#
On 2/1/2021 10:27 PM, Mark Kamichoff wrote:
I couldn't find any option to disable bracketed paste in readline itself or vtysh. Shells like Zsh and Bash have options for it in their config files.
On FreeBSD at least, for the port (devel/readline) I added CONFIGURE_ARGS= --disable-bracketed-paste-default to disable it by default. ---Mike
Does anyone know how to disable bracketed paste in vtysh? Or, is there something else funky going on here?
I'm using rxvt-unicode on Linux/X11. I tested this with Terminal.app on Big Sur as well and got the same result.
Thanks!
- Mark
[0] https://cirw.in/blog/bracketed-paste [1] https://lwn.net/Articles/839213/ (see h. in the CHANGES list)
_______________________________________________ frog mailing list frog@lists.frrouting.org https://lists.frrouting.org/listinfo/frog
On Fri, Feb 05, 2021 at 04:29:24PM -0500, mike tancsa wrote:
On FreeBSD at least, for the port (devel/readline) I added
CONFIGURE_ARGS= --disable-bracketed-paste-default
to disable it by default.
This seems like a good workaround but I also found another one. Add this to your ~/.inputrc: set enable-bracketed-paste Off Then start vtysh again. Pasting should work properly. However, if you're using sudo you will have to start vtysh using sudo -E because without the -E your user's ~/.inputrc won't be read (this threw me off initially). I opened up a bug because I don't think bracketed paste will ever be suitable for folks using vtysh to interact with FRR: https://github.com/FRRouting/frr/issues/8029 - Mark -- Mark Kamichoff prox@prolixium.com https://www.prolixium.com/
FRR should have bracketed paste forcibly turned off in the next release, thanks for bringing this to our attention. Quentin ________________________________ From: frog <frog-bounces@lists.frrouting.org> on behalf of Mark Kamichoff <prox@prolixium.com> Sent: Saturday, February 6, 2021 9:38 PM To: mike tancsa <mike@sentex.net> Cc: frog@lists.frrouting.org <frog@lists.frrouting.org> Subject: Re: [FROG] readline 8.1 and bracketed pasting in vtysh External email: Use caution opening links or attachments On Fri, Feb 05, 2021 at 04:29:24PM -0500, mike tancsa wrote:
On FreeBSD at least, for the port (devel/readline) I added
CONFIGURE_ARGS= --disable-bracketed-paste-default
to disable it by default.
This seems like a good workaround but I also found another one. Add this to your ~/.inputrc: set enable-bracketed-paste Off Then start vtysh again. Pasting should work properly. However, if you're using sudo you will have to start vtysh using sudo -E because without the -E your user's ~/.inputrc won't be read (this threw me off initially). I opened up a bug because I don't think bracketed paste will ever be suitable for folks using vtysh to interact with FRR: https://github.com/FRRouting/frr/issues/8029 - Mark -- Mark Kamichoff prox@prolixium.com https://www.prolixium.com/ _______________________________________________ frog mailing list frog@lists.frrouting.org https://lists.frrouting.org/listinfo/frog
participants (3)
-
Mark Kamichoff -
mike tancsa -
Quentin Young