Skip to content

Rust errors (rust-terminfo) lack color on FreeBSD #48574

Closed
@bdrewery

Description

@bdrewery

FreeBSD only provides a /etc/termcap file, not any of the terminfo directory structures searched for in https://github.com/rust-lang/rust/blob/master/src/libterm/terminfo/searcher.rs. The parser would need to learn to read the plaintext hashed file format of /etc/termcap rather than the terminfo binary read it does at https://github.com/rust-lang/rust/blob/master/src/libterm/terminfo/parser/compiled.rs#L188.

Installing the devel/ncurses port does not fix this directly since it is compiled to generate a /usr/local/share/misc/terminfo.db file rather than the directory structure expected at /usr/share/misc/terminfo. rust-terminfo lacks support for both the terminfo.db format and the /usr/local path. Not that those should be fixed.

A workaround is to modify its Makefile and change --with-hashed-db to --without-hashed-db, remove the terminfo.db staging, install, and then symlink the /usr/local/share_terminfo path to /usr/share/terminfo. This is simply a workaround though. The port should not be a requirement for rust on FreeBSD just for colors.

I'm exploring installing /usr/share/terminfo on FreeBSD but it may not happen as it's not as trivial as it sounds. There's a cap_mkdb tool that is ran when /etc/termcap is modified that will need to be expanded to run tic (which isn't installed now). But worse is that it's entirely possible to not run cap_mdb at all when modifying /etc/termcap so the /usr/share/terminfo directory entries could be wrong. It seems more reliable to just add support for reading /etc/termcap in rust-terminfo.

For reference, there was a discussion in FreeBSD a few years ago about why termcap was still being used. No one really objected and Thomas Dickey of terminfo happened to chime in as well (https://lists.freebsd.org/pipermail/freebsd-arch/2014-February/015081.html).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.O-freebsdOperating system: FreeBSD

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions