dspinellis/git-issue

Trying to run 'git_issue.sh' using absolute path doesn't work due to missing lib

Closed this issue · 6 comments

I tried to run git-issue.sh directly without installing it, but I get the following error:

No git-issue directory in path <path_to_repo>/git-issue/../lib:/usr/local/lib:/usr/lib

In the script itself I found:

LIB_PATH="$(dirname $0)/../lib:$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib"

This looks suspicious, as $(dirname $0) should return already return the path to the repo root. If I change it to $(dirname $0)/lib, then everything works.

The tests work, because the test.sh script explicitly sets GIT_ISSUE_LIB_PATH to $(pwd)/lib.

I'll have a look and see if I can figure out how to write a test for this that unsets GIT_ISSUE_LIB_PATH and tries to run the script.

I think the current LIB_PATH setting caters to the case where, say, the binary is installed in /usr/local/bin/git-issue. This would introduce /usr/local/lib into the LIB_PATH.

/usr/local/lib is already injected explicitly.

If you think the $(dirname $0)/../lib might be needed for some other use case, we could leave it, but we definitely need $(dirname $0)/lib to support the git config --global alias.issue '!'"${REPO_PATH}/git-issue.sh" use case described in the README.

I meant /usr/local/bin as an example. Consider as a better example /app/git-issue/bin.

I agree to add the $(dirname $0)/lib case.

Fixed by #77