Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LFE REPL doesn't start in Erlang 26.0 #79

Closed
oubiwann opened this issue Jul 9, 2023 · 8 comments
Closed

LFE REPL doesn't start in Erlang 26.0 #79

oubiwann opened this issue Jul 9, 2023 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@oubiwann
Copy link
Member

oubiwann commented Jul 9, 2023

The command rebar3 lfe repl continues to do what one would expect (and what it has done for a while) in older Erlang versions, but in 26.0 instead of starting the LFE REPL, we're dropped into the Erlang shell.

After digging around in the Erlang 26.0 release notes, the rebar3 commit logs, and the LFE commit logs, nothing jumps out at me, with the possible exception of the Erlang shell + tty support getting a make-over in 26 (the LFE REPL starts up with the following options: tty_sl -c -e which is what made me pause when I read about the tty changes in 26).

Related tickets:

@oubiwann oubiwann added the bug Something isn't working label Jul 9, 2023
@oubiwann oubiwann added this to the 0.4.0 milestone Jul 9, 2023
@oubiwann
Copy link
Member Author

oubiwann commented Aug 3, 2023

@rvirding created a fix for this in LFE itself, and was released as part of LFE 2.1.2:

However, this fix does not work for the rebar3_lfe plugin, despite countless attempts. I have reached out to the rebar3 maintainers for advice/suggestions/etc, and will update this ticket as more info comes in.

Slack thread link:

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

I gave a run-down on the LFE Slack today (yesterday), summarised here:

  • In Erlang 25, after starting the REPL with rebar3 lfe repl and executing the code (erlang:function_exported 'shell 'start_interactive 0) one gets a result of false
  • this is important, since it is under that false condition that rebar3 proper will set up a custom shell based upon the provided args
  • iow, it is due to that false that we get a nice LFE REPL from the rebar3_lfe plugin
  • however, in Erlang 26.0, when the REPL fails to start from our plugin, we're dumped into an erl shell ... and when one runs the code erlang:function_exported(shell, start_interactive, 0). one gets a result of true
  • that means that our custom shell code cannot be run with the current setup

Or, more precisely: all my attempts to work around this have failed and it's not immediately clear to me what change I could make in a plugin that would allow the LFE REPL to run using the rebar3 code as it is.

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

Fred helpfully shared the commit that introduced this change: erlang/rebar3@5944a8e

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

okay, I finally got it working ... but I had to hack rebar_prv_shell to do it, changing this:

start_interactive() ->
    shell:start_interactive()

to this:

start_interactive(ShellArgs) ->
    user_drv:start_shell(ShellArgs).

this was purely an exercise in trial and error, since I really don't get how shell:start_interactive works or what it does under the hood (not matter what I did, I couldn't talk it into starting LFE). And I have no idea if this is considered bad form ...

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

this sadly require copying a huge chunk of rebar3 code into our plugin -- but if we can figure out the right fix for this instead of that hack, we can submit a PR to rebar3 and delete the copied code

I'll cut a new release with this "fix" ...

oubiwann added a commit that referenced this issue Aug 5, 2023
@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

Fix is here: b2db65e

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

This broke our support for Erlang 19 and 20.

@oubiwann
Copy link
Member Author

oubiwann commented Aug 5, 2023

I'll open a new ticket for reverting this change. The revert will have to wait until we see a fix in rebar3, though.

Also: fix is published on hex.pm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant