# Strange Terminal Behavior

## Yarui

I just finished installing Gentoo for the first time and was messing with some stuff in the terminal.  I used emerge --help --verbose to see what some of the flags in a command meant and started scrolling through the information.  When I scrolled back down to the bottom of the terminal I found this.

 *Quote:*   

> owner@gen-shuttle ~ $ 
> 
> owner@gen-shuttle ~ $ 0 23560 pjp
> 
> -bash: 0: command not found
> ...

 

It appears as though some text from the forums was entered in a line at a time as shell commands.  I am not sure where this came from, I was looking at the frequently asked questions section a few minutes earlier, which is where these lines seem to have come from.  I didn't, however, have anything copied from that page and was no longer on it.  I am not sure where these lines spontaneously came from so I thought I would ask if anyone else has ever seen anything like this before.  This seems like a possible security issue, so I thought the security section would probably be the best place to ask about it.

UPDATE:  I think I figured out what caused this to happen.  If I highlight something in my browser then middle click on my terminal window it pastes the highlighted text.  Does anyone know how I could disable this functionality?  The middle click on my mouse is extremely sensitive and easy to accidentally click, so I would prefer not to be constantly pasting stuff on accident.  The strange thing is I don't think I even had anything highlighted when it happened the first time.

----------

## BradN

Yes, this is what causes it.  Your terminal program may have an option to disable this, otherwise I don't know of a way to generally prevent it without disabling or remapping the middle mouse button entirely.

Another possible cause of spurious terminal entry is a program outputting character sequences that make the terminal report data back to the program as keyboard input (eg, sensing terminal size, things like that).  I think usually these just show up as numbers, but I can't remember exactly.  If you ever cat a binary you can end up with this (and other screwy terminal behavior as most of us know...)

Luckily it doesn't seem possible to insert arbitrary data into the terminal buffer through output in this way, so it's not a big security issue, just a minor annoyance.  If catting a file could perform a "rm -rf /", something would be changed.

Craziest terminal bug I know of was in the Windows NT series for a long time (patched finally sometime in XP) - outputting certain sequences of tabs and backspaces in a terminal window would reliably crash the whole machine.

----------

