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

Bats 1.10.0: Hitting error "tput: No value for $TERM and no -T specified" in Concourse CI #819

Open
sriemer opened this issue Nov 15, 2023 · 3 comments
Labels
Component: Bash Code Everything regarding the bash code Component: CLI Command line flags, exit code handling, ... Priority: Medium Wrong or misleading documentation, broken behavior with workaround Status: Confirmed The reproducer worked as described Type: Bug

Comments

@sriemer
Copy link

sriemer commented Nov 15, 2023

Describe the bug
Running our tests based on Bats in Concourse CI with a Ubuntu 20.04 docker image causes the following error:
tput: No value for $TERM and no -T specified.

The Concourse CI environment is using TERM=dumb.

To Reproduce
Steps to reproduce the behavior:

  1. use your favorite Bats tests (assuming file.bats)
  2. run TERM="" bats file.bats

See the only output:

tput: No value for $TERM and no -T specified

Return code: 2 (ENOENT)

Expected behavior
Bats is not failing if tput fails and TERM is not set or is set to dumb.
Bats is running in a safe mode without colors and any other fancy terminal features.

Environment (please complete the following information):

  • Bats version 1.10.0
  • operating system: Linux, Ubuntu 20.04 Docker image from DockerHub: ubuntu:20.04
  • bash --version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
  • Install method: curl -L -O -J https://github.com/bats-core/bats-core/archive/v1.10.0.tar.gz
  • Running on Concourse CI build server

Additional context
The Concourse CI environment is using TERM=dumb.
Also running TERM="" bats -x --verbose-run file.bats causes the same single line output.
Using workaround [[ -z "$TERM" || "$TERM" == "dumb" ]] && export TERM="xterm-256color" for now.

@sriemer sriemer added Priority: NeedsTriage Issue has not been vetted yet Type: Bug labels Nov 15, 2023
@sriemer
Copy link
Author

sriemer commented Nov 23, 2023

@martin-schulze-vireso Any hint which component might be affected? Otherwise, I'll look into this myself.
Candidates:

update_screen_width() {
screen_width="$(tput cols)"
,
if [[ -z "${CI:-}" && -t 0 && -t 1 ]] && command -v tput >/dev/null; then

The testing build also only contains a workaround for this:
TERM: linux # fix tput for tty issue work around

@martin-schulze-vireso
Copy link
Member

The main culprit is probably the pretty formatter.

@martin-schulze-vireso martin-schulze-vireso added Priority: Medium Wrong or misleading documentation, broken behavior with workaround Component: Bash Code Everything regarding the bash code Component: CLI Command line flags, exit code handling, ... Status: Unconfirmend No reproducer was provided or the reproducer did not work for maintainers. and removed Priority: NeedsTriage Issue has not been vetted yet labels Dec 18, 2023
@martin-schulze-vireso martin-schulze-vireso added Status: Confirmed The reproducer worked as described and removed Status: Unconfirmend No reproducer was provided or the reproducer did not work for maintainers. labels Jan 27, 2024
@yangit
Copy link

yangit commented Apr 10, 2024

I want to get pretty output to file and unable to because of that.
That output can be useful since a lot of parsers for TAP format have edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Bash Code Everything regarding the bash code Component: CLI Command line flags, exit code handling, ... Priority: Medium Wrong or misleading documentation, broken behavior with workaround Status: Confirmed The reproducer worked as described Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants