Bug 272126 - vi: Misleading error "No terminal database found" in case of unsupported terminal type
Summary: vi: Misleading error "No terminal database found" in case of unsupported term...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-21 07:24 UTC by Valentin Nechayev
Modified: 2023-06-21 08:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin Nechayev 2023-06-21 07:24:55 UTC
Happens at least with `vi`, other full-screen tools might suffer as well.
If an unsupported terminal is in TERM, `vi` rejects starting with a misleading message:

$ TERM=abc123 vi 111
vi: No terminal database found

i.e. "no terminal database found" instead of "no terminal database entry found", "unknown terminal type", etc.

The message can confuse even experienced users, not saying for novices. For me it appeared during system upgrade in virtualbox, TERM was `screen.xterm-256color` as provided by newer `screen` versions (even after forcing with "-T screen" - this is `screen` issue not for this ticket), so, the exact moment suggested upgrade error.

Please consider replacing it with more elaborated error description.
Comment 1 Mina Galić freebsd_triage 2023-06-21 08:17:14 UTC
this seems to be a limitation of the https://man.freebsd.org/setupterm(3) function.
the code is there, https://github.com/freebsd/freebsd-src/blob/133b132bc1b612abe591c8f54680c3da8491e194/contrib/nvi/cl/cl_main.c#L228 but we don't hit it