NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: termcap issue



khym%azeotrope.org@localhost (Dave Huang) writes:

>On Aug 22, 2015, at 18:02, Michael van Elst <mlelstv%serpens.de@localhost> wrote:
>> It depends on what keyboard you use, pckbd sends ^?, ukbd sends ^h.

>Doesn't that inconsistency cause problems then? E.g., if the terminfo 
>entry for wsvt25 says that erase is ^H and tset sets it to that, but 
>you're using pckbd.

Indeed, it does.


>Does the keyboard driver pass whatever erase key it's sending on to the 
>tty layer?

The default of the tty driver is to use the DEL character:

#define CERASE          0177

const cc_t ttydefchars[NCCS] = {
...
        [VERASE] = CERASE,
...
};

And that's used (e.g. in single-user mode) until set by getty.
getty would interpret the 'er' attribute in /etc/gettytab,
but currently there is no such attribute and getty just keeps
the setting.

When you log in on the console, the shell executes tset in
the .login script, which then interprets TERM as set by
init from /etc/ttys.


>I commented out the call to tset in my .login and logged in 
>on the console with a pckbd keyboard, and erase was set to ^?. I don't 
>know how it was set, and I don't know whether it'd be set to ^H if I 
>used a ukbd.

It wouldn't be.

ukbd sends KS_Backspace for the backarrow key which is translated
to ^H. Your tty driver needs to have erase set to ^H to interpret that
correctly.




>From what I can tell, tset setting the erase character is mainly useful 
>for serial terminals--

Indeed, it's written for local terminals. It's support for network
connections is pretty limited. The default usage used to be:

eval `tset -s -m 'network:?xterm'`

I.e. it was assumed that the remote login mechanism would set TERM=network
and that this should be interpreted as xterm.



>for network terminals (pretty much just ssh these 
>days, but IIRC this is the case for telnet too. Don't know about 
>rlogin), the client will send the appropriate character to the server. 

ssh will do that.

telnet and rlogin only pass the TERM variable.



>On the one hand, I certainly want serial terminals to work properly... 
>I use serial console on a few of my systems. But on the other hand, I 
>suspect network logins are much more common than serial, and tset 
>breaking network logins is a problem. They're certainly much more 
>common for me... I ssh to NetBSD systems every day, but I only look at 
>a serial console maybe every few months or even less than that.

>Is there some way to get this working properly everywhere? In another 
>message, you said:

>> The tty is almost always set to something.  You needed
>> to set something explicitely to an undefined value to
>> make tset configure it, which makes tset a bit useless.

>So what sets the tty to something?

That's the tty driver default setting: CERASE == ^?. A value
of _POSIX_VDISABLE_ would be the 'undefined' value. You can set
that value with 'stty erase undef'.


>I don't know if this is a good idea, 
>but my idea would be that if the erase character is known, it'll be set 
>early on.

FreeBSD removed the tset call from login in 1995, replaced it first
with a fixed 'stty erase ^H' and then dropped it altogether. I am
not sure if that is the best approach, but it surely avoids the
ssh-login problem.

An alternative would be to remove the kbs attribute from 'remote terminals'
in the terminfo database.

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index