ghantoos / lshell

lshell is a shell coded in Python, that lets you restrict a user's environment to limited sets of commands, choose to enable/disable any command over SSH (e.g. SCP, SFTP, rsync, etc.), log user's commands, implement timing restriction, and more.
GNU General Public License v3.0
436 stars 111 forks source link

command is executed after history ctrl-c #105

Closed ghantoos closed 8 years ago

ghantoos commented 9 years ago

When searching through the readline history, using ctrl-r. If the search is cancelled (with ctrl-c), the command mysteriously appears back on the line and is executed. This could be dangerous in some cases/commands.

Thanks to François Rieux for reporting this bug.

ghantoos:~$ 
(reverse-i-search)`ls ': ls nRVmmn8RGypVneYIp8HxyVAvaEaD55
ghantoos:~$ ls nRVmmn8RGypVneYIp8HxyVAvaEaD55  <---- CTRL-C, then ENTER
ls: cannot access nRVmmn8RGypVneYIp8HxyVAvaEaD55: No such file or directory
ghantoos commented 9 years ago

After looking into the bug, I stumbled on a recent python bug report (https://bugs.python.org/issue24266), that eventually was traced down to GNU/readline (https://lists.gnu.org/archive/html/bug-readline/2015-05/msg00014.html).

This seems to be an issue with the callback functionality in readline, which is why bash (for example) doesn't exhibit the problem.

À suivre.