Repository navigation
Install env scripts in receipts dir instead of bin dir - #2423
Conversation
ftr, we install Just to check, is this in response to a specific issue that someone ran into? |
|
Yes the specific issue is an annoying corner case that's "the user made their life hard, but also, because they were making kind of reasonable assumptions": they did some equivalent of of |
|
hey! just wanted to see if there's anything we can do to help with this. not entirely sure how it ended up as executable on our users systems, but it would be great if we can get it moved regardless! happy to help |
|
Sorry for the delay reviewing this! I've simply been very busy lately, but hope to get to it soon. |
|
totally get it! btw if you opened a github sponsors for the org or yourself, we would totally sponsor you. dist is awesome and very much appreciated |
There was a problem hiding this comment.
Gave this a test, and confirmed it's working with both bash and fish.
Left one comment on something I'd like to clarify just a little so we remember the context in the future.
I did notice in testing that I ended up with repeated copies of the . source statement for the new path in my .bashrc. Only the sh version, not fish. I believe there's a specific sequence of events in which, if you have old and new versions at once in the same file, this makes it possible to end up with duplicate identical statements post-migration. (I didn't find the specific repro steps but I believe it involves installing old/new versions of the software in a particular order.) That's probably harmless, though we could dedupe while rewriting.
| local _fish_env_script_path="$8" | ||
| local _fish_env_script_path_expr="$9" | ||
|
|
||
| if is_legacy_env_script_sh "$_install_dir_expr" "$_legacy_env_script_path"; then |
There was a problem hiding this comment.
Nit: this confused me on first read because we didn't actually change the content of the shell scripts at all. This isn't really checking if it's a legacy env script, it's asking if the script at the specified path is a dist env script at all. Let's be clearer about what these are doing.
54e73bf to
879aeb1
Compare
This attempts to address one of the original cardinal sins of cargo-dist: that in flat installs we create a sourceable script called
envin the bin dir, where it can shadow/usr/bin/env.This sin was originally forced by us not having any other directory we could put these files in, along with historical momentum of cargo calling the file
env.Since then we have introduced receipts, which means we have another dir where we can shove other random non-executable stuff.
envtoenv.shbecause come on it's a shell script by any other name, even though it's only eversourcedenv.shandenv.fishto the receipt direnvandenv.fishfiles from the bin dir, if they look like they were made by usAs always I am profoundly unconfident in my shell scripting (codex did most of it, but I don't even trust my reviews of shell code).