tests: Fix hardcoded /bin/bash shebangs
We're using the `/bin/bash` shebang in many of the scripts we're writing in our test suite. This path is not guaranteed to exist by POSIX though, and it in fact doesn't on NixOS, for example. Unfortunately, there is no way to make this portable according to the POSIX standard except to rewrite the shebang: Furthermore, on systems that support executable scripts (the "#!" construct), it is recommended that applications using executable scripts install them using getconf PATH to determine the shell pathname and update the "#!" script appropriately as it is being installed (for example, with sed). For example: This is not really practical though. There are two alternatives that are commonly used in practice though: 1. Use `/bin/sh` and stop using Bashisms. This binary really exists on virtually every platform, even on NixOS. This would require us to port over existing test scripts to be compatible. 2. Use `/usr/bin/env bash`, which resolves the shell via PATH. This does not require us to port shell scripts and works in practice. Convert our test scripts to use the second option, as it is the easier one of both and addresses the underlying issue on NixOS.
Showing
- cmd/gitaly-hooks/hooks_test.go 1 addition, 1 deletioncmd/gitaly-hooks/hooks_test.go
- internal/command/command_test.go 5 additions, 5 deletionsinternal/command/command_test.go
- internal/git/gittest/intercepting_command_factory.go 1 addition, 1 deletioninternal/git/gittest/intercepting_command_factory.go
- internal/git/localrepo/repo_test.go 1 addition, 1 deletioninternal/git/localrepo/repo_test.go
- internal/gitaly/hook/custom_test.go 4 additions, 4 deletionsinternal/gitaly/hook/custom_test.go
- internal/gitaly/linguist/linguist_test.go 1 addition, 1 deletioninternal/gitaly/linguist/linguist_test.go
- internal/gitaly/server/auth_test.go 1 addition, 1 deletioninternal/gitaly/server/auth_test.go
- internal/gitaly/service/hook/pre_receive_test.go 2 additions, 2 deletionsinternal/gitaly/service/hook/pre_receive_test.go
- internal/gitaly/service/hook/update_test.go 1 addition, 1 deletioninternal/gitaly/service/hook/update_test.go
- internal/gitaly/service/objectpool/create_test.go 1 addition, 1 deletioninternal/gitaly/service/objectpool/create_test.go
- internal/gitaly/service/operations/tags_test.go 2 additions, 2 deletionsinternal/gitaly/service/operations/tags_test.go
- internal/gitaly/service/repository/archive_test.go 1 addition, 1 deletioninternal/gitaly/service/repository/archive_test.go
- internal/gitaly/service/repository/fetch_remote_test.go 1 addition, 1 deletioninternal/gitaly/service/repository/fetch_remote_test.go
- internal/gitaly/service/repository/fetch_test.go 1 addition, 1 deletioninternal/gitaly/service/repository/fetch_test.go
- internal/gitaly/service/repository/replicate_test.go 1 addition, 1 deletioninternal/gitaly/service/repository/replicate_test.go
- internal/gitaly/service/ssh/upload_pack_test.go 1 addition, 1 deletioninternal/gitaly/service/ssh/upload_pack_test.go
Please register or sign in to comment