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-preprocess: command not found in bats 1.11.0-rc1 #858

Closed
gioele opened this issue Feb 4, 2024 · 2 comments · Fixed by #865
Closed

bats-preprocess: command not found in bats 1.11.0-rc1 #858

gioele opened this issue Feb 4, 2024 · 2 comments · Fixed by #865
Labels
Component: Bash Code Everything regarding the bash code Priority: Critical Broken behavior in nearly all environments, e.g. wrong test results, internal bats error Status: Confirmed The reproducer worked as described Type: Bug
Milestone

Comments

@gioele
Copy link
Contributor

gioele commented Feb 4, 2024

Describe the bug

ruby-build's tests fail when run with bats 1.11.0-rc1

 24s autopkgtest [19:14:20]: test command1: [-----------------------
 24s /usr/lib/bats-core/preprocessing.bash: line 12: bats-preprocess: command not found
 24s 1..1
 24s not ok 1 bats-gather-tests
 24s # (in test file test/build.bats, line 26)
 24s #   `tarball "$@"' failed with status 127
 25s autopkgtest [19:14:21]: test command1: -----------------------]

https://ci.debian.net/packages/r/ruby-build/unstable/amd64/42695794/

To Reproduce

Steps to reproduce the behavior:

  1. Check out https://salsa.debian.org/ruby-team/ruby-build/
  2. Run bats tests/

Expected behavior

The tests should run without any internal bats error.

Environment (please complete the following information):

  • Bats version: 1.11.0-rc1
  • operating system (including version): Debian unstable+experimental
  • bash --version: 5.2.21
  • Install method: Debian package
@gioele gioele added Priority: NeedsTriage Issue has not been vetted yet Type: Bug labels Feb 4, 2024
@brokenpip3
Copy link
Contributor

can you post the same test with the trace (-x) option?

@martin-schulze-vireso
Copy link
Member

After investigating a bit it seems like there might be interference due to the path changes which are done here.

The problem only exists when there are multiple files in the suite and the PATH is changed. Preprocessing the second file will fail because the PATH has been changed and does not contain libexec/bats-core (which contains bats-preprocess) anymore.

I believe the correct path of action would be to harden all parts of Bats that go into bats-gather-tests against this kind of interference. This is why bats-gather-tests has been extracted in the first place, to reduce the surface where free test code and Bats internals might interact.

@martin-schulze-vireso martin-schulze-vireso added Priority: Critical Broken behavior in nearly all environments, e.g. wrong test results, internal bats error Component: Bash Code Everything regarding the bash code Status: Confirmed The reproducer worked as described and removed Priority: NeedsTriage Issue has not been vetted yet labels Feb 20, 2024
@martin-schulze-vireso martin-schulze-vireso added this to the 1.11.0 milestone Feb 20, 2024
martin-schulze-vireso added a commit to martin-schulze-vireso/bats-core that referenced this issue Feb 20, 2024
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 Priority: Critical Broken behavior in nearly all environments, e.g. wrong test results, internal bats error Status: Confirmed The reproducer worked as described Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants