hseg · GitHub

(Note: Very niche reproducer)

As noted in https://github.com/simonmichael/hledger/blob/master/hledger/Hledger/Cli/CliOptions.hs#L626, ifthe terminfo entry for $TERM can't be read, setupTermFromEnv throws an error. In particular, I'm encountering this when building hledger in a clean chroot that contains all its build dependencies, but doesn't contain the terminfo definitions for the terminal (kitty) I'm running the chrooted build in.

I'm a little loath to add kitty to the chroot unnecessarily, especially in view of the fact that hledger doesn't actually need an entire terminfo entry, just enough to tell the number of columns in the terminal. Given that the tests also pass with TERM=dumb, I'm guessing that its fallback settings are widely supported enough to work as an alternative.

Hence, I'd either recommend replacing the call to setupTermFromEnv with

setupTermFromEnv `catch` \(_ :: SetupTermError) -> setupTerm "dumb"

or document this dependency on TERM being valid somewhere (perhaps this ticket suffices).

For my part, I'm adding TERM="dumb" to my packaging script until this is fixed (much like I'd set LANG=C to reset to a known-good situation).

Read the original on github.com ↗