Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bdrewery opened this issue Feb 27, 2018 · 3 comments
Closed

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

bdrewery opened this issue Feb 27, 2018 · 3 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-freebsd Operating system: FreeBSD

Comments

@bdrewery
Copy link
Contributor

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).

@bdrewery
Copy link
Contributor Author

Found more discussion at Stebalien/term#44 and it seems Stebalien/term#71 may even mitigate the issue by adding a fallback mechanism for ANSI. Will test an update locally.

@pietroalbini pietroalbini added C-enhancement Category: An issue proposing an enhancement or a PR with one. O-freebsd Operating system: FreeBSD labels Feb 27, 2018
@bdrewery
Copy link
Contributor Author

term was just replaced with termcolor in #48588, will see how that impacts this.

@bdrewery
Copy link
Contributor Author

#48588 fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-freebsd Operating system: FreeBSD
Projects
None yet
Development

No branches or pull requests

2 participants