dnkl/foot
41
2.0k
Fork
You've already forked foot
243

Issues with terminfo in a non-standard location #695

Closed
opened 2021年08月28日 12:16:11 +02:00 by dnkl · 20 comments
Owner
Copy link

This is an attempt to collect all issues seen with having our terminfo installed in a non-standard location:

  1. sudo (#691, #694), doas (#692), ssh (#691) all drop TERMINFO by default. All can be configured to not do that, but e.g. ssh requires modifying both the client and server configs. Regardless, it's bad user experience
  2. gpg decrypt fails (#697).
  3. ncurses can be built with --disable-root-environ
  4. Exporting TERMINFO apparently breaks the netbsd-curses build. Not sure that one can be blamed on us though.

One of the reasons I went with the current approach (installing terminfo to a non-standard location, and setting TERMINFO) was to be able gracefully fallback to the ncurses provided terminfo definitions.

Once ncurses with its new foot terminfo definitions are out, point 1 and 2 in the list will be a smaller problem since then we'll fallback to ncurses.

However, it also means we silently switch to a less capable terminfo.

Thus, the question is, do we wait for ncurses to be released, and have that "fix" these issues (by silently falling back to a less capable terminfo), or do we change foot's default terminfo to something different (e.g. fot - "foot" in Swedish) and install it in the standard location, and stop exporting TERMINFO?

This is an attempt to collect all issues seen with having our terminfo installed in a non-standard location: 1. sudo (https://codeberg.org/dnkl/foot/issues/691, https://codeberg.org/dnkl/foot/issues/694), doas (https://codeberg.org/dnkl/foot/issues/692), ssh (https://codeberg.org/dnkl/foot/issues/691) all drop `TERMINFO` by default. All can be configured to not do that, but e.g. ssh requires modifying both the client and server configs. Regardless, it's bad user experience 1. gpg decrypt fails (https://codeberg.org/dnkl/foot/issues/697). 1. ncurses can be built with `--disable-root-environ` 1. Exporting `TERMINFO` apparently breaks the netbsd-curses build. Not sure that one can be blamed on us though. One of the reasons I went with the current approach (installing terminfo to a non-standard location, and setting `TERMINFO`) was to be able gracefully fallback to the ncurses provided terminfo definitions. Once ncurses with its new foot terminfo definitions are out, point 1 and 2 in the list will be a smaller problem since then we'll fallback to ncurses. However, it also means we silently switch to a less capable terminfo. Thus, the question is, do we wait for ncurses to be released, and have that "fix" these issues (by silently falling back to a less capable terminfo), or do we change foot's default terminfo to something different (e.g. `fot` - "foot" in Swedish) and install it in the standard location, and stop exporting `TERMINFO`?
Author
Owner
Copy link

Seeing that several distributions are likely to rename the terminfos (and install them in the standard location) anyway, I think it makes sense to make that the default here in upstream as well.

Thus, we need a new name for the terminfo. Name suggestions so far:

  • fot ("foot" in Swedish)
  • bigfoot (as in, bigger, more featureful than "foot" from ncurses)
  • foot-term
  • foot-sure
  • foot-extra
  • foot-directors-cut (no, not being entirely serious about this one...)
Seeing that several distributions are likely to rename the terminfos (and install them in the standard location) anyway, I think it makes sense to make that the default here in upstream as well. Thus, we need a new name for the terminfo. Name suggestions so far: * fot ("foot" in Swedish) * bigfoot (as in, bigger, more featureful than "foot" from ncurses) * foot-term * foot-sure * foot-extra * foot-directors-cut (no, not being entirely serious about this one...)
Author
Owner
Copy link

Note the following comment from https://dickey.his.com/ncurses/terminfo.ti.html:

# Terminal names look like <manufacturer> <model> - <modes/options>
# The part to the left of the dash, if a dash is present, describes the
# particular hardware of the terminal. The part to the right may be used
# for flags indicating special ROMs, extra memory, particular terminal modes,
# or user preferences.

Our case is a bit of a gray area. But our terminfo and ncurses' do represent the same "manufacturer" and model, and our terminfo can be considered a "mode" (the "More Features" mode).

Which means I think foot-<something> is ok.

Note the following comment from https://dickey.his.com/ncurses/terminfo.ti.html: > _\# Terminal names look like \<manufacturer> \<model> - \<modes/options> > \# The part to the left of the dash, if a dash is present, describes the > \# particular hardware of the terminal. The part to the right may be used > \# for flags indicating special ROMs, extra memory, particular terminal modes, > \# or user preferences._ Our case is a bit of a gray area. But our terminfo and ncurses' _do_ represent the same "manufacturer" and model, and our terminfo _can_ be considered a "mode" (the "More Features" mode). Which means I think `foot-<something>` is ok.

First of, thanks for maintaining this great piece of software.

I copied the terminfo back to the standard location for the time being, and all is working fine so far (had issues with manpages after the update).

How about "foot-sure"?

First of, thanks for maintaining this great piece of software. I copied the terminfo back to the standard location for the time being, and all is working fine so far (had issues with manpages after the update). How about "foot-sure"?
Author
Owner
Copy link

I copied the terminfo back to the standard location for the time being, and all is working fine so far.

Copying them to ~/.terminfo/f/ should also work, if you don't want to litter the system directories.

How about "foot-sure"?

I may be too tired, but what's the logic behind it?

> I copied the terminfo back to the standard location for the time being, and all is working fine so far. Copying them to `~/.terminfo/f/` _should_ also work, if you don't want to litter the system directories. > How about "foot-sure"? I may be too tired, but what's the logic behind it?

I copied the terminfo back to the standard location for the time being, and all is working fine so far.

Copying them to ~/.terminfo/f/ should also work, if you don't want to litter the system directories.

How about "foot-sure"?

I may be too tired, but what's the logic behind it?

In English it means something like 'to not slip' or 'to walk steadily'.

Will use ~/.terminfo/f/ instead - thank you for the hint. :) EDIT: It does work very well!

> > I copied the terminfo back to the standard location for the time being, and all is working fine so far. > > Copying them to `~/.terminfo/f/` _should_ also work, if you don't want to litter the system directories. > > > How about "foot-sure"? > > I may be too tired, but what's the logic behind it? In English it means something like 'to not slip' or 'to walk steadily'. Will use `~/.terminfo/f/` instead - thank you for the hint. :) EDIT: It *does* work very well!

I think that foot-extra would be a good option, albeit a plain one.

I think that `foot-extra` would be a good option, albeit a plain one.
Author
Owner
Copy link

Another issue with renaming the terminfo is all applications out there doing strcmp(TERM, "foot"), or similar...

Hopefully, they already do strncmp(TERM, "foot", 4), to handle the already existing foot-direct terminfo.

But I know for sure there are those that don't.

In any case, for this reason, using a foot-something name is better than a completely new name.

Another issue with renaming the terminfo is all applications out there doing `strcmp(TERM, "foot")`, or similar... Hopefully, they already do `strncmp(TERM, "foot", 4)`, to handle the already existing `foot-direct` terminfo. But I know for sure there are those that don't. In any case, for this reason, using a foot-something name is better than a completely new name.
Collaborator
Copy link

FWIW, using hyphens in the "root" name goes against the recommendations in the terminfo(5) man page:

Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware making up the terminal should have a root name, thus "hp2621". This name should not contain hyphens. Modes that the hardware can be in, or user preferences, should be indicated by appending a hyphen and a mode suffix. Thus, a vt100 in 132-column mode would be vt100-w.

I make use of this naming convention in dte by extracting the value of $TERM, up to the first hyphen, and then using bsearch() to search a list of known "root" names.

There are already a few terminals that don't follow this convention (xterm-kitty, xterm-termite, ms-terminal) and it's not a particularly big deal to add special cases for those that don't, but I feel it'd be a shame if new terminals started ignoring it en masse.

FWIW, using hyphens in the "root" name goes against the recommendations in the `terminfo(5)` man page: > Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware making up the terminal should have a root name, thus "hp2621". This name should not contain hyphens. Modes that the hardware can be in, or user preferences, should be indicated by appending a hyphen and a mode suffix. Thus, a vt100 in 132-column mode would be vt100-w. I make use of this naming convention in `dte` by [extracting] the value of `$TERM`, up to the first hyphen, and then using `bsearch()` to search a list of known "root" names. There are already a few terminals that don't follow this convention (`xterm-kitty`, `xterm-termite`, `ms-terminal`) and it's not a particularly big deal to add special cases for those that don't, but I feel it'd be a shame if new terminals started ignoring it en masse. [extracting]: https://gitlab.com/craigbarnes/dte/-/blob/dbc256bc6b0416875df8a6d1dfc73db09200e3e2/src/terminal/terminal.c#L173-186
Author
Owner
Copy link

@craigbarnes if we go with, say, foot-extra, I would still consider "foot" to be the root name. Don't you agree?

I do think it would be nice to have a completely different name, to distance us from ncurses. Just not sure I'm prepared to break applications that are already string comparing against "foot".

@craigbarnes if we go with, say, foot-extra, I would still consider "foot" to be the root name. Don't you agree? I do think it would be nice to have a completely different name, to distance us from ncurses. Just not sure I'm prepared to break applications that are already string comparing against "foot".
Collaborator
Copy link

if we go with, say, foot-extra, I would still consider "foot" to be the root name.

Yeah, that's actually a good point. foot-extra would still work fine for my purposes, with no changes required.

I guess we could also consider -extra to be something akin to a "mode", so perhaps that doesn't even break the ncurses "modes" convention either.

I do think it would be nice to have a completely different name, to distance us from ncurses.

I've been thinking maybe it would make sense to just embrace the upstream terminfo entry and try to solve the few remaining issues by some other means. The non-standard capabilities aren't even useful to programs that use the curses API, since no curses implementation actually uses them. They're only there to help programs that query the terminfo DB and then use their own tty routines. Those kinds of programs can just as well detect the same info some other way. I think if we present a strong enough case to the tmux maintainers, they'll add support for $COLORTERM (or something similar).

The packaging situation could be handled by just explaining to packagers "install the provided terminfo entry only if your ncurses version is < x". The compile-from-git situation doesn't really suffer from filename clashes, since people doing that will most likely be installing under /usr/local or ~/.local.

> if we go with, say, foot-extra, I would still consider "foot" to be the root name. Yeah, that's actually a good point. `foot-extra` would still work fine for my purposes, with no changes required. I guess we could also consider `-extra` to be something akin to a "mode", so perhaps that doesn't even break the ncurses "modes" convention either. > I do think it would be nice to have a completely different name, to distance us from ncurses. I've been thinking maybe it would make sense to just embrace the upstream terminfo entry and try to solve the few remaining issues by some other means. The non-standard capabilities aren't even useful to programs that use the curses API, since no curses implementation actually uses them. They're only there to help programs that query the terminfo DB and then use their own tty routines. Those kinds of programs can just as well detect the same info some other way. I think if we present a strong enough case to the `tmux` maintainers, they'll add support for `$COLORTERM` (or something similar). The packaging situation could be handled by just explaining to packagers "install the provided terminfo entry only if your ncurses version is < x". The compile-from-git situation doesn't really suffer from filename clashes, since people doing that will most likely be installing under `/usr/local` or `~/.local`.
Contributor
Copy link

However, it also means we silently switch to a less capable terminfo.

I apologize for my stupid question. Why is fixing the ncurses upstream terminfo not an option? Or is this issue about a workaround until the ncurses updates are shipped on every machine (which takes a long time I figure).

> However, it also means we silently switch to a less capable terminfo. I apologize for my stupid question. Why is fixing the ncurses upstream terminfo not an option? Or is this issue about a workaround until the ncurses updates are shipped on every machine (which takes a long time I figure).
Collaborator
Copy link

Why is fixing the ncurses upstream terminfo not an option?

There's nothing to fix as far as the ncurses maintainer is concerned. He won't add the extra (non-standard) capabilities to the upstream terminfo DB because ncurses itself doesn't need or use them.

Or is this issue about a workaround until the ncurses updates are shipped on every machine (which takes a long time I figure).

It's about a bunch of things. Issues #670 and #671 are probably the best thing to read to get an idea of the tradeoffs involved.

Also relevant: IRC log from yesterday.

> Why is fixing the ncurses upstream terminfo not an option? There's nothing to fix as far as the ncurses maintainer is concerned. He won't add the extra (non-standard) capabilities to the upstream terminfo DB because ncurses itself doesn't need or use them. > Or is this issue about a workaround until the ncurses updates are shipped on every machine (which takes a long time I figure). It's about a bunch of things. Issues #670 and #671 are probably the best thing to read to get an idea of the tradeoffs involved. Also relevant: IRC [log](https://libera.irclog.whitequark.org/foot/2021-08-28#1630189484-1630190767;) from yesterday.
Contributor
Copy link

There's nothing to fix as far as the ncurses maintainer is concerned. He won't add the extra (non-standard) capabilities to the upstream terminfo DB because ncurses itself doesn't need or use them.

Ah okay. Thanks for the explanation.

> There's nothing to fix as far as the ncurses maintainer is concerned. He won't add the extra (non-standard) capabilities to the upstream terminfo DB because ncurses itself doesn't need or use them. Ah okay. Thanks for the explanation.
Author
Owner
Copy link

After sleeping on this, I think @craigbarnes is right, and that the best way forward is to give in and just use the ncurses terminfo definitions.

What this actually means is:

  • Default TERM continues to be foot
  • Default install location will be ${datadir}/terminfo.
  • Install instructions will be updated to reflect this, and to suggest our terminfo definitions are only installed if ncurses is "too old".
  • I will keep the non-standard capabilities in our terminfos, and will document, perhaps on the Wiki, how users can manually build and install them to ~/.terminfo.
  • We should also document, on the Wiki, how to configure tmux to work with ncurses' terminfos.

The Arch AUR packages have already been updated to install the terminfos to /usr/share/terminfo, and foot no longer exports TERMINFO.

After sleeping on this, I think @craigbarnes is right, and that the best way forward is to give in and just use the ncurses terminfo definitions. What this actually means is: * Default `TERM` continues to be `foot` * Default install location will be `${datadir}/terminfo`. * Install instructions will be updated to reflect this, and to suggest our terminfo definitions are only installed if ncurses is "too old". * I will keep the non-standard capabilities in our terminfos, and will document, perhaps on the Wiki, how users can manually build and install them to `~/.terminfo`. * We should also document, on the Wiki, how to configure tmux to work with ncurses' terminfos. The Arch AUR packages have already been updated to install the terminfos to `/usr/share/terminfo`, and foot no longer exports `TERMINFO`.
Author
Owner
Copy link

As for why I decided to do this, rather than e.g. renaming our terminfo to foot-extra, is it causes the least amount of problems.

Renaming the files means potentially breaking user configurations. But more importantly, we'll be breaking applications that string compare against foot.

Furthermore, having a new name also means we cannot fallback to ncurses' when our terminfo isn't available.

As for _why_ I decided to do this, rather than e.g. renaming our terminfo to `foot-extra`, is it causes the least amount of problems. Renaming the files means potentially breaking user configurations. But more importantly, we'll be breaking applications that string compare against `foot`. Furthermore, having a new name also means we cannot fallback to ncurses' when our terminfo isn't available.
Contributor
Copy link

Could you list what tmux does differently with TERM=xterm-256color vs TERM=foot (ncurses) vs TERM=foot (foot) ? I think on IRC you mentioned neovim too, so if that's also affected then could list that as well?

Basically if you're saying that using tmux in foot functionally requires the user to configure tmux (to add terminal-overrides) / configure foot (to change term to something else that already works with tmux) / build and install foot's custom terminfo manually, then it sounds like an install of foot will not work with tmux out of the box. I would not like such a situation for OpenSUSE, and would lean towards having the OpenSUSE package install the terminfos as foot-extra and make TERM=foot-extra the default.

Could you list what tmux does differently with `TERM=xterm-256color` vs `TERM=foot` (ncurses) vs `TERM=foot` (foot) ? I think on IRC you mentioned neovim too, so if that's also affected then could list that as well? Basically if you're saying that using tmux in foot functionally *requires* the user to configure tmux (to add `terminal-overrides`) / configure foot (to change `term` to something else that already works with tmux) / build and install foot's custom terminfo manually, then it sounds like an install of foot will not work with tmux out of the box. I would not like such a situation for OpenSUSE, and would lean towards having the OpenSUSE package install the terminfos as `foot-extra` and make `TERM=foot-extra` the default.
Author
Owner
Copy link

The biggest issue is truecolor support. Tmux "knows" xterm can do it, so if $TERM contains the string "xterm", it enables truecolor.

Tmux also supports the non-standard terminfo capabilities Tc, setrgbf and setrgbb, and when these are found, it uses them for truecolor, regardless of $TERM. These capabilities are only set in "our" terminfo definitions, but not in any ncurses definitions.

At least that's how I have understood things, but I don't use tmux myself.

Basically if you're saying that using tmux in foot functionally requires the user to configure tmux (to add terminal-overrides) / configure foot (to change term to something else that already works with tmux) / build and install foot's custom terminfo manually, then it sounds like an install of foot will not work with tmux out of the box.

That would be correct. @craigbarnes thinks we can push tmux to recognize $COLORTERM, and if so, that would remove the need for these non-standard capabilities.

and would lean towards having the OpenSUSE package install the terminfos as foot-extra and make TERM=foot-extra the default.

I intend to make that possible. Just be aware that there are applications doing strcmp($TERM, "foot") that will break. Unfortunately, I cannot remember which ones.

There's also the Sync capability, the informs applications foot can do "Application Synchronized Updates, which prevents tearing. But, not having it in the terminfo definition won't break anything. And I'm not aware of anyone but tmux using it (to limited effect, at that).

The biggest issue is truecolor support. Tmux "knows" xterm can do it, so if `$TERM` contains the string "xterm", it enables truecolor. Tmux also supports the non-standard terminfo capabilities `Tc`, `setrgbf` and `setrgbb`, and when these are found, it uses them for truecolor, regardless of `$TERM`. These capabilities are only set in "our" terminfo definitions, but not in **any** ncurses definitions. At least that's how I have understood things, but I don't use tmux myself. > Basically if you're saying that using tmux in foot functionally requires the user to configure tmux (to add terminal-overrides) / configure foot (to change term to something else that already works with tmux) / build and install foot's custom terminfo manually, then it sounds like an install of foot will not work with tmux out of the box. That would be correct. @craigbarnes thinks we can push tmux to recognize $COLORTERM, and if so, that would remove the need for these non-standard capabilities. > and would lean towards having the OpenSUSE package install the terminfos as foot-extra and make TERM=foot-extra the default. I intend to make that possible. Just be aware that there **are** applications doing `strcmp($TERM, "foot")` that will break. Unfortunately, I cannot remember which ones. There's also the `Sync` capability, the informs applications foot can do "Application Synchronized Updates, which prevents tearing. But, not having it in the terminfo definition won't break anything. And I'm not aware of anyone but tmux using it (to limited effect, at that).
Author
Owner
Copy link

#698 should be ready now. I'm sure the documentation can be improved upon, but the build system has been updated with the new defaults.

https://codeberg.org/dnkl/foot/pulls/698 should be ready now. I'm sure the documentation can be improved upon, but the build system has been updated with the new defaults.

Still an issue on nixos/sway. Setting TERM=xterm fixes the problem with gpg

Still an issue on nixos/sway. Setting TERM=xterm fixes the problem with gpg
Author
Owner
Copy link

Report this to nixos, since they build foot in a way that sets TERMINFO_DIRS.

Report this to nixos, since they build foot in a way that sets TERMINFO_DIRS.
Sign in to join this conversation.
No Branch/Tag specified
master
osc-5522
sixel-heap-buffer-overflow
releases/1.27
releases/1.26
releases/1.25
releases/1.24
multi-cursor
releases/1.23
pixman-16f-2
releases/1.22
releases/1.21
releases/1.20
releases/1.19
releases/1.18
releases/1.17
releases/1.16
releases/1.15
releases/1.14
releases/1.13
releases/1.12
releases/1.11
releases/1.10
releases/1.9
releases/1.8
releases/1.7
releases/1.6
releases/1.5
releases/1.4
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.27.0
1.26.1
1.26.0
1.25.0
1.24.0
1.23.1
1.23.0
1.22.3
1.22.2
1.22.1
1.22.0
1.21.0
1.20.2
1.20.1
1.20.0
1.19.0
1.18.1
1.18.0
1.17.2
1.17.1
1.17.0
1.16.2
1.16.1
1.16.0
1.15.3
1.15.2
1.15.1
1.15.0
1.14.0
1.13.1
1.13.0
1.12.1
1.12.0
1.11.0
1.10.3
1.10.2
1.10.1
1.10.0
1.9.2
1.9.1
1.9.0
1.8.2
1.8.1
1.8.0
1.7.2
1.7.1
1.7.0
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.0
1.0.0
0.9.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
7 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot#695
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?