1 |
Ciaran McCreesh <ciaranm <at> gentoo.org> writes: |
2 |
|
3 |
> Now, there's a slight problem. If you have TERM=shinynewterm, and |
4 |
> you ssh to a box with an old terminfo database, you'll get a warning |
5 |
> or error that your terminal isn't recognised when you try to use an |
6 |
> ncurses-based application. You can either ask the sysadmin to |
7 |
> upgrade, or you can install the relevant terminfo files into |
8 |
> ~/.terminfo. This isn't a major problem, but the local terminfo |
9 |
> thing isn't very well known, so some people have this silly |
10 |
> misconception that you're either screwed or have to export a fake |
11 |
> TERM if the box you're on doesn't recognise your terminal. |
12 |
|
13 |
The best solution to this that I can think of is to extend OpenSSH |
14 |
with the capability to copy terminfo information to ~/.terminfo on the |
15 |
remote system. |
16 |
|
17 |
This solution would have these advantages: |
18 |
|
19 |
* The actual TERM name "xterm" or "gnome" or "rxvt" would no longer |
20 |
matter at all. Applications could lie all they like and we would |
21 |
not be bothered. All that is necessary is that on your home system |
22 |
things would be set up so that the TERM value determines the right |
23 |
information in the local terminfo database or your own ~/.terminfo. |
24 |
When OpenSSH copies the information to the remote system, it would |
25 |
check in the remote terminfo information (both the system database |
26 |
and your ~/.terminfo) for an exact match on the specifications and |
27 |
if so reuse the name with the matching data; otherwise it would pick |
28 |
a fresh name following a specific convention (e.g., |
29 |
"xterm-via-ssh-3" where "-via-ssh-3" is added just to be different) |
30 |
and insert the data in your remote ~/.terminfo. |
31 |
|
32 |
* The correct information would always be available. No terminal |
33 |
application would ever have to be used with crippled specifications. |
34 |
|
35 |
* When terminal applications start up, they could choose their own |
36 |
name (and bump it with each revision that adds features or removes |
37 |
bugs) and ensure that the correct information was stored in |
38 |
~/.terminfo. This would avoid the problem of stale information in |
39 |
the terminfo database. (Well, some cruft would accumulated in the |
40 |
personal ~/.terminfo area, but the entire directory could safely be |
41 |
deleted whenever you have no programs running on the system, e.g., |
42 |
at boot time.) |
43 |
|
44 |
* The terminfo database could eventually no longer matter. It would |
45 |
be needed only for legacy terminal applications that don't supply |
46 |
their own information and for terminal applications whose authors |
47 |
supply the wrong information (and in both cases the information |
48 |
would only be needed on the system the application starts on, |
49 |
because OpenSSH would copy the correct values to where they were |
50 |
needed). |
51 |
|
52 |
* The extension to OpenSSH seems not too hard to implement. OpenSSH |
53 |
can run "infocmp" to get a terminfo description as a big string. |
54 |
OpenSSH already has support (at least in SSH protocol version 2) for |
55 |
copying the values of some environment variables like TERM, so it |
56 |
could just reuse this same mechanism to copy the data to the remote |
57 |
system. On the remote machine, "tic" can be used to insert the |
58 |
terminfo description into ~/.terminfo. |
59 |
|
60 |
* Only the OpenSSH package needs to be modified. Although the various |
61 |
terminal applications would benefit from installing accurate |
62 |
self-descriptions in ~/terminfo when they start up, this is not |
63 |
needed. |
64 |
|
65 |
* The solution is 100% backward compatible. Existing usage remains |
66 |
exactly the same. No programs have to be changed other than |
67 |
OpenSSH. Old versions of OpenSSH would still work just as they do |
68 |
now; they would just be missing the new advantage. |
69 |
|
70 |
* If OpenSSH fails in copying the terminfo data into ~/.terminfo on |
71 |
the remote system, it can fall back to the old approach just by |
72 |
stripping off any "-via-ssh-*" suffix from the TERM value. (This |
73 |
means the convention for picking fresh names needs to be |
74 |
reversible.) |
75 |
|
76 |
* The solution would be automatically deployed worldwide through the |
77 |
regular updating of OpenSSH. People will tend to update OpenSSH |
78 |
more quickly than other packages due to the desire to keep their |
79 |
security up-to-date. Anyway, this solution would be another |
80 |
motivation for everyone to stay upgraded to the latest version of |
81 |
OpenSSH, which is always a good thing. |
82 |
|
83 |
* Maybe some more people would dump proprietary SSH if they don't add |
84 |
the feature quickly enough. :-) |
85 |
|
86 |
-- |
87 |
Joe Wells |
88 |
|
89 |
P.S. I don't normally read this forum at all, so if you want me to |
90 |
see any replies please e-mail a copy to me. |
91 |
|
92 |
|
93 |
-- |
94 |
gentoo-dev@g.o mailing list |