Re:Using /usr/local
by masklinn on Wednesday September 12, 2012 @12:57PM
(#4511627)
My experience is exactly the opposite wrt fragility: fully hardcoded paths assume that the hardcoded path can and will have all the required dependencies, which — at least for modern Python development — is always the wrong assumption to make. Essentially, it only ever works if the script is run on the same version of the same distribution with the same package manager and installed packages as the original developer of the script. This is the most brittle a script can get.
> it's important to make sure that your scripts are run using the executable that has their dependencies installed.
Which a hardcoded shebang path does not do, it assumes these things but does not assert them and does not "make sure" of anything.
> If you use env shebangs, there's no way to do that
There's no way to make unwarranted assumptions is about as far as it goes: using env shebangs, the caller of the utility has control over what happens and which executable gets called (even indirectly)
> you're limited to either using the first executable on the path or manually specifying the executable on the command line to bypass the shebang.
Or specify a PATH when calling the script, or run the script in overridden PATH environments (e.g. virtualenvs), or...
> I'm not saying that you shouldn't use env shebags, because they really are fine for a lot of scripts.
And I went (and would still go) much further and state that they're the right solution for the vast majority of scripts and utilities.
> However, you should always be mindful of what they mean and how that could break your script in the future.
So should you be with hardcoded shebang paths, and they are much more likely to break a script across porting than env shebangs.
> it's important to make sure that your scripts are run using the executable that has their dependencies installed.
Which a hardcoded shebang path does not do, it assumes these things but does not assert them and does not "make sure" of anything.
> If you use env shebangs, there's no way to do that
There's no way to make unwarranted assumptions is about as far as it goes: using env shebangs, the caller of the utility has control over what happens and which executable gets called (even indirectly)
> you're limited to either using the first executable on the path or manually specifying the executable on the command line to bypass the shebang.
Or specify a PATH when calling the script, or run the script in overridden PATH environments (e.g. virtualenvs), or...
> I'm not saying that you shouldn't use env shebags, because they really are fine for a lot of scripts.
And I went (and would still go) much further and state that they're the right solution for the vast majority of scripts and utilities.
> However, you should always be mindful of what they mean and how that could break your script in the future.
So should you be with hardcoded shebang paths, and they are much more likely to break a script across porting than env shebangs.