develooper Front page | perl.perl5.porters | Postings from March 2000

$PERL_VERSION triggers vt100 answerback sequence!!

From:
Tom Christiansen
Date:
March 18, 2000 15:58
Subject:
$PERL_VERSION triggers vt100 answerback sequence!!
Message ID:
29434.953423877@chthon
Well, I've just spent a happy time murdering spurious xterms that
Perl has, through some indirection, been launching for me. 

Um, watch this:

    % cd bleadperl 
    % ./perl -Ilib -MEnglish -e 'print $PERL_VERSION' | cat -v
    ^E^F^@

It was even worse with _67:

    % perl5.5.670 -MEnglish -e 'print $PERL_VERSION' | cat -v
    ^E^EM-JM-^^

From p13 of the "Digital VT100 User Guide":

    "Answerback is a question and answer sequence where the host
    computer asks the terminal to identify itself. The VT100
    answerback feature provides the terminal with the capability
    to identify itself by sending a message to the host. [...]

    The answerback message may also be transmitted by typing CTRL-BREAK."

A CTRL-E, that is, chr(5), is the ASCII ENQ control character.
This is very unhappy.  When you print it out, your vt100 tells you
what it "really" is.  

Now, eventually this will start to get better for people
on xterms.  

    http://www.clark.net/pub/dickey/xterm/xterm.log.html

	Patch #101 - 1999/5/10 - XFree86 3.9Pm
	    change default answerback response to an empty string.

Without this patch, each ^E punch "xterm" *into your input buffer*.
That means it appears to your shell (or to whoever is reading your
input stream) that you've just typed that.  Or whatever your terminal
self-identifies as.  And you can't assume the xterm hack.  All the
world isn't an xterm, let alone up to date.

I don't have a suggestion.  But.... can this really right?

I further note:

    % ./perl -Ilib -MEnglish -e 'printf "%d\n", $PERL_VERSION' | cat -v
    5
    % ./perl -Ilib -MEnglish -e 'printf "%f\n", $PERL_VERSION' | cat -v
    5.006000
    % ./perl -Ilib -MEnglish -e 'printf "%c\n", $PERL_VERSION' | cat -v
    ^E
    % ./perl -Ilib -MEnglish -e 'printf "%.1s\n", $PERL_VERSION' | cat -v
    ^E

I've never seen something in Perl before where a %c and a %.1s can 
print the same thing.

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About