Skip to content

Conversation

@quantenzitrone
Copy link
Contributor

this makes the script runnable on nixos and other distros that don't install bash in /bin

this makes the script runnable on nixos and other distros that don't install bash in /bin
@@ -1,9 +1,14 @@
#!/bin/bash
#!/usr/bin/env bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to /usr/bin
but -1 to env because of https://jmmv.dev/2016/09/env-considered-harmful.html
Can you just put there /usr/bin/bash ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing /bin/bash to /usr/bin/bash doesn't make it any more portable.

e.g. on NixOS only /bin/sh and /usr/bin/env exist in their default locations.
everything else is installed in /run/current-system/sw/bin, ~/.local/state/nix/profile or sometimes even just part of the $PATH

or on MacOS /bin/bash is stuck on some old version because Apple couldn't handle GPL3 or something
using /usr/bin/env bash makes it possible to run the script with the homebrew installed bash in /opt/homebrew/bin/bash

I disagree with quite a few points in this blog post:
i-iii) using anything other than /usr/bin/env doesn't guarantee that the correct interpreter is used, however using /usr/bin/env lets the user set the correct interpreter using by configuring $PATH
v) The entire point of using /usr/bin/env is to be at the mercy of the users environment configuration.
Why is not ok for a program to assume $PATH contains the correct binary but it's ok for it to assume that the correct binary is installed in a specific location like /usr/bin/bash?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have my opinion about env, but if that resolves your problem on NixOS... it makes no harm on other OSes. So +1 from me.

@xsuchy xsuchy merged commit ee5c712 into spdx:main Oct 15, 2025
2 checks passed
@jlovejoy jlovejoy added this to the 3.28.0 milestone Oct 16, 2025
@quantenzitrone quantenzitrone deleted the fix-test-one-license branch October 17, 2025 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants