Skip to content
Snippets Groups Projects
Commit fa42b8e1 authored by Patrick Steinhardt's avatar Patrick Steinhardt
Browse files

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.
parent 770edd2d
Showing
with 25 additions and 25 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment