tweag / nix_bazel_codelab

Nix+Bazel Codelab
Apache License 2.0
50 stars 4 forks source link

Fix/missing shebang #19

Closed rapenne-s closed 2 years ago

rapenne-s commented 2 years ago

I found a script calling another script with ${SHELL} which is terrible. My SHELL is defined to fish and is not POSIX compliant. It wasn't obvious to debug this error.

./generate_build_files.sh
./generate_workspace.sh (line 7) : Expected a string, but found a redirection
cat > WORKSPACE <<EOF
     ^
warning: Error while reading file ./generate_workspace.sh

The error was displayed by fish because it was explicitly called on the script generate_workspace.sh

googleson78 commented 2 years ago

Is a missing/version mismatched /bin/sh ever an issue? i.e. should this instead be provided from shell.nix?

rapenne-s commented 2 years ago

The big issue here is using ${SHELL} in a script to run another script. I use fish as a shell and it's not POSIX compliant, so when you use it to run a sh/bash script, problems happen. I added the shebangs because it's good practice and ensure the script is running with the expected interpreter.

AFAIK /bin/sh is one of the pieces of NixOS that are still available as a default, it's always there. There is nothing to add to shell.nix.