>From a quick look it will happily fall back to carriage return and space
if the capabilities it would prefer (el and hpa/RI) are not present, so
probably anything would do.

Or you could check if the terminfo entry existed with something like
"tput el >/dev/null 2>&1" before running pkg_add.


On Thu, Jan 05, 2023 at 08:45:47AM +0100, Patrik Lundin wrote:
> Hello,
> 
> There was recently a bug report opened for the ansible module
> openbsd_pkg, where someone was getting errors due to pkg_add disliking
> their TERM setting:
> https://github.com/ansible-collections/community.general/issues/5738
> 
> Basically they are running TERM=xterm-kitty locally, which makes pkg_add
> disable the progress meter, easily testable like so:
> ```
> orbb# nmap
> ksh: nmap: not found
> orbb# TERM=xterm-kitty pkg_add nmap
> No progress meter: failed termcap lookup on xterm-kitty
> quirks-6.42 signed on 2022-12-09T12:59:38Z
> orbb# nmap
> Nmap 7.91 ( https://nmap.org )
> [...]
> ```
> 
> I can agree with the reporter that it would be better to have the
> ansible module "do the right thing" and set some lowest common
> denominator TERM instead of depending on the whims of a local
> environment. From what I can tell both "dumb" (as suggested by the
> reporter) and "unknown" seems to still print the progress bar:
> ```
> # TERM=unknown pkg_delete nmap
> nmap-7.91p2: ok
> Read shared items: ok
> ```
> 
> ... and:
> ```
> # TERM=dumb pkg_add nmap
> quirks-6.42 signed on 2022-12-09T12:59:38Z
> nmap-7.91p2: ok
> ```
> 
> Basically I am asking if any specific choice of a TERM would be
> preferred if we would make openbsd_pkg always set one of them for the
> different pkg_* tools.
> 
> Regards,
> Patrik Lundin
> 

Reply via email to