1) Set shell command line editing mode to vi. 2) Execute some command (ex: 'ls -l') 3) Use escape to enter command line editing. 4) Use 'k' to view last command. 5) Use ^V to enter full screen vi. 6) Modify old command (ex: change to 'man sh'). 7) Use :wq to exit vi 8) Edited command will fail. I saw output of '-sh: ma: not found)
Created attachment 162193 [details] correctly use buffer sizes This patch makes libedit read the text into the current buffer correctly. If you make the text much longer in the editor, it will be truncated (and then executed in its truncated form).
A commit references this bug: Author: jilles Date: Tue Oct 27 21:16:30 UTC 2015 New revision: 290065 URL: https://svnweb.freebsd.org/changeset/base/290065 Log: libedit: Use correct buffer lengths in vi mode v command. Libedit's vi mode provides a v command to edit the current line in vi(1) (hard-coded to vi, in fact). When Unicode/wide character mode was added, this command started truncating and/or corrupting the edited text. This commit fixes v if the text fits into the buffer. If the text is longer, it is truncated. PR: 203743 Obtained from: NetBSD (originally submitted by me) Changes: head/lib/libedit/vi.c