Skip to content

Conversation

rktjmp
Copy link
Contributor

@rktjmp rktjmp commented Aug 29, 2025

When Expert.Port detects the elixir executable, it extracts the current env from mise/rtx if present, by calling mise env -s bash. This returns

...
export PATH='<path>'
...

If we don't strip the surrounding single quotes, later when we re-inject PATH into the environmetn, sh will fail to intepret it correctly, meaning future calls to any mise managed executables such as erl will fail as a command not found. This will then cause servers to fail to load and bubble an {:erpc, :noconnection} error up to the user.

#59 (comment)

rktjmp and others added 2 commits August 30, 2025 01:50
When Expert.Port detects the elixir executable, it extracts the current
env from mise/rtx if present, by calling `mise env -s bash`. This
returns

    ...
    export PATH='<path>'
    ...

If we don't strip the surrounding single quotes, later when we re-inject
`PATH` into the environmetn, `sh` will fail to intepret it correctly,
meaning future calls to any `mise` managed executables such as `erl`
will fail as a command not found. This will then cause servers to fail
to load and bubble an `{:erpc, :noconnection}` error up to the user.

elixir-lang#59 (comment)
@rktjmp
Copy link
Contributor Author

rktjmp commented Aug 29, 2025

One user in the linked thread said they had issues with asdf, but I think its because they were running elixir 1.14, which I don't think the nightly build is generated to support (looking at the CI workflow). This is why I did not apply the patch to the asdf branch. I could not find any examples or mention outside of lexical that referenced PATH_SAVE + asdf, so I'm not sure if that would also need adjusting.

You can see the described failure case by doing something like this:

# in /bin/sh, which is what elixir's shell launcher scripts run under, not bash!
# and assuming you have something to run not in a default path such as /usr/bin etc
# eg: you have ~/.local/bin/expert
$ expert
<ctrl-c> # it works
$ PATH="'$PATH'"
$ expert
sh: expert: command not found

@rktjmp rktjmp changed the title fix: Trim any quotes wrapping PATH when elixir is managed by mise fix: trim any quotes wrapping PATH when elixir is managed by mise Aug 29, 2025
@doorgan
Copy link
Collaborator

doorgan commented Aug 29, 2025

I could not find any examples or mention outside of lexical that referenced PATH_SAVE + asdf

That's a leftover from the previous packaging method, we should remove the PATH_SAVE workaround

One user in the linked thread said they had issues with asdf, but I think its because they were running elixir 1.14

There is one specific project of mine that is giving a similar error to the one described in the comment(it is not finding erl) so I think this may be affecting asdf as well

@rktjmp
Copy link
Contributor Author

rktjmp commented Aug 29, 2025

I did test asdf 0.18, elixir 1.17, erlang 27, expert nightly in a container but it just worked for me.

You could try the same logging I did in that comment, see what $PATH is inside the elixir script.

Copy link
Collaborator

@doorgan doorgan left a comment

Choose a reason for hiding this comment

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

Yeah, there is something else that is preventing my asdf from finding erl that is unrelated to the bug you found, so let's merge this one

@doorgan doorgan merged commit d828966 into elixir-lang:main Aug 29, 2025
17 of 18 checks passed
zoedsoupe added a commit to zoedsoupe/expert that referenced this pull request Aug 30, 2025
…w-nix-override

* 'main' of github.com:elixir-lang/expert:
  docs: update VSCode instructions
  chore: add .tool-versions for zig (elixir-lang#88)
  fix: make sure asdf shims are in the PATH (elixir-lang#87)
  docs: add zig installation instructions to installation prerequisites (elixir-lang#85)
  fix: trim any quotes wrapping PATH when elixir is managed by mise (elixir-lang#82)
  ci: tweak text in commit title comment
  ci: post comment on PR when it fails the semantic pr title
  docs: add zed to installation (elixir-lang#71)
  docs: update nightly installation instructions (elixir-lang#67)
  docs: fix zig version in README.md (elixir-lang#66)
  chore: add install task to justfile (elixir-lang#65)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants