Wednesday, March 4, 2009

Re: [BLUG] How do you like to get rid of terminal corruption?

On Wed, Mar 04, 2009 at 01:06:21PM -0500, Gillis, Chad wrote:
> Quoting Mark Krenz <mark@slugbug.org>:
>> Ok, just kidding. I'm curious though, how do you usually like to get
>> rid of terminal corruption? Do you just close the terminal or are you
>> daring and try to reverse it by cat'ing out /dev/urandom or /dev/sda?
>> Sometimes I'll try cat'ing /dev/urandom, but something makes me think
>> that its dangerous to do that. Anyone know?
>
> What does cat /dev/urandom acheive? Doesn't that just say spew random
> garbage? Is it the homeopathic method? :)

The issue is that some garbage sent to the terminal emulator mucked
up some setting and now you can't read any new text. The scroll back
is unimpacted, presuming that wasn't cleared or just swamped. (This is
due to the problem being the character set being set oddly. VT100's
supported a concept of an 'alternate' character set which would contain
characters not normally in the main character set. You could send a
control sequence to change the character set. This allowed for non-Latin
glyphs on some models of those early terminals.)

cat'ing /dev/urandom is normally a good way to achieve just such an
unreadable terminal. This is what makes it 'daring' as Mark said. If it
can cause such a problem, just maybe it can clear such a problem.

The danger in random escape codes is related primarily to the extensions
supported by your terminal emulator as well as certain design decisions.
If all windows of an application are handled within a single main
process, and you send a strange undocumented escape code (which is
undocumented as it relates to an incomplete feature that crashes the
terminal emulator) it could be possible to crash all of your open
terminal emulator windows.

Personally, I wouldn't try any of the random character methods. Instead,
I'd do what I mentioned in a previous email and just use a client-side
reset command.

--
Steven Black <blacks@indiana.edu> / KeyID: 8596FA8E
Fingerprint: 108C 089C EFA4 832C BF07 78C2 DE71 5433 8596 FA8E

No comments: