Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Fix call to ../libexec/bats from bin/bats when install/bin/bats is not current dir or parameters are passed #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonathandandries
Copy link

The following procedure failed:

  1. In "Git Bash" for windows.

  2. $ git clone https://github.com/sstephenson/bats.git

  3. $ ./bats/install.sh /usr/local

    Installed Bats to /usr/local/bin/bats

  4. $ bats mytest.bats

    /usr/local/bin/bats: line 1: ../libexec/bats: No such file or directory

Fixed by modifying bin/bats to be aware of $(dirname $0), and then I figured out that I also needed to pass parameters, hence "$@"

…rrent directory and parameters are passed.
@dimo414
Copy link

dimo414 commented Sep 15, 2017

This might be a bug in "Git Bash for windows" (I don't know what that is). BATS runs just fine via both WSL and Cygwin. I'd suggest using one of those instead.

@jonathandandries
Copy link
Author

Thanks Michael,

Git Bash is just a linux emulator for Windows that you get when you install Git on Windows:
https://git-for-windows.github.io/

I reported my environment as FYI, but I honestly think the bug I fixed is going to happen on any environment. The install.sh script is installing a script that is supposed to make a call back to ../libexec/bats. The only way that would work is if you are in the pwd with that script and if you don't pass any parameters.

@dimo414
Copy link

dimo414 commented Sep 19, 2017

I honestly think the bug I fixed is going to happen on any environment

I can imagine that being true, but empirically it works fine on Linux, Cygwin, WSL, and OSX (and notably the Travis CI is also failing with this PR), which makes it seem a lot more like an issue specific to Git on Windows.

@jonathandandries
Copy link
Author

Thanks Michael,

I don't know how it's working, but if it works, go for it. Note I just noticed that the travis-ci build is failing on something that looks to be independent of my change:

"/home/travis/.travis/job_stages: line 57: bin/bats: No such file or directory"

I'm curious if that build works on the master branch as it is.

Cheers,

Jonathan

@dimo414
Copy link

dimo414 commented Sep 19, 2017

I'm pretty sure the failure is related to your PR - the master branch is passing (though admittedly it's old), and I don't see that error in other recent PRs. Seeing as you're changing how Bats its invoked and loaded a "No such file" error seems likely to be related.

@cornfeedhobo
Copy link

cornfeedhobo commented Dec 6, 2018

On Suse Linux here and having the same issue.
The relative lookup breaks when executing from another directory.
This patch fixes the issue. Looking forward to seeing this PR merged.

@dimo414
Copy link

dimo414 commented Dec 6, 2018

You probably want to migrate to https://github.com/bats-core/bats-core

@cornfeedhobo
Copy link

cornfeedhobo commented Dec 7, 2018

I'll follow up with the project I am working on that embeds this as a sub-module, but I still think this should be merged. It's small and the value add is clear. Can't see a downside (although I have no idea what the CI failure is right now).

@dimo414
Copy link

dimo414 commented Dec 8, 2018

@cornfeedhobo again, migrate to bats-core; this project is dead.

@cornfeedhobo
Copy link

I see. thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants