Skip to content

Bug/517/otp 28 user drv - #518

Merged
rvirding merged 6 commits into
developfrom
bug/517/otp-28-user-drv
Jul 8, 2026
Merged

rvirding merged 6 commits into
developfrom
bug/517/otp-28-user-drv

Conversation

@oubiwann

@oubiwann oubiwann commented Jun 7, 2026

Copy link
Copy Markdown
Member

Fixes #517

LFE's CI matrix covers OTP 22 through 29. The user_drv / user interface has
three distinct shapes across that range, and the input key's type changed
between OTP 27 and 28, so a single input => cooked cannot be used across all
OTP 26+ versions:

OTP noshell startup API input type
22–25 user:start() N/A
26–27 user_drv:start(#{initial_shell => noshell}) boolean() (default true)
28+ user_drv:start(#{initial_shell => noshell, input => cooked}) cooked | raw | disabled (no default)

Passing input => cooked on OTP 26–27 crashes with case_clause inside
prim_tty:init_term/1, which pattern-matches input against true and
false only. So the three eras need three branches.

The existing code uses string comparison (OTPRelease >= "26"), which works for
two-digit OTP versions (22–29) but fails for single-digit or three-digit
releases ("9" > "28" is true; "100" > "28" is false). Using
list_to_integer/1 is more robust and costs nothing.

oubiwann added 3 commits June 6, 2026 20:54
Three-branch version dispatch using list_to_integer(OTPRelease) instead of string comparison:
- OTP 28+: user_drv:start(#{initial_shell => noshell, input => cooked}) — provides the required input key
- OTP 26-27: user_drv:start(#{initial_shell => noshell}) — unchanged, input defaults to true
- OTP <26: user:start() — the legacy API

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates LFE’s -eval/noshell startup path to correctly handle user_drv API differences across OTP 22–29 (especially the required input key on OTP 28+), and extends CI/test coverage to prevent regressions.

Changes:

  • Switch OTP version comparison in lfe_init from string comparison to integer comparison.
  • Add OTP 28+ noshell branch that passes input => cooked to user_drv:start/1.
  • Add a Common Test suite for lfe -eval behavior and expand CI to run OTP 28 and 29.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/lfe_init.erl Adds OTP-version branching for user_drv noshell startup and uses integer-based OTP comparisons.
test/lfe_init_SUITE.lfe New CT suite validating lfe -eval output and exit status across OTP versions.
.github/workflows/cicd.yml Expands the OTP matrix to include 28 and 29.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/lfe_init_SUITE.lfe Resolved
@rvirding
rvirding merged commit 773ae17 into develop Jul 8, 2026
16 checks passed
rvirding pushed a commit that referenced this pull request Jul 12, 2026
* Makefile: split DESTDIR and PREFIX  (#513)

* Makefile: use portable "command -v" instead of the "which" command

Signed-off-by: Maciej Barć <[email protected]>

* Makefile: split DESTDIR and PREFIX

* Use DESTDIR as the output directory, default to /.  Normally it
  would be used like so: make DESTDIR="$(pwd)/image/" install
* Run MANDB only if DESTDIR is /, so only when we install onto the
  system root.

Signed-off-by: Maciej Barć <[email protected]>

---------

Signed-off-by: Maciej Barć <[email protected]>

* Bug/517/otp 28 user drv (#518)

* Added failing tests for issue #517.

See: #517

* Fix for OTP 28 user_drv behaviour change.

Three-branch version dispatch using list_to_integer(OTPRelease) instead of string comparison:
- OTP 28+: user_drv:start(#{initial_shell => noshell, input => cooked}) — provides the required input key
- OTP 26-27: user_drv:start(#{initial_shell => noshell}) — unchanged, input defaults to true
- OTP <26: user:start() — the legacy API

* Updated OTP versions for CI.

* Implement this less awkwardly.

* We need the full build for the new CT test.

* Addressed review feedback.

* ensure directory exists before writing the beam file... (#508)

this happend when integrating with a mix project.

* Feature/271/clj prints (#519)

* Added tests for new clj print macros.

* Implemented clj print functions.

* Updated docs.

* Feature/277/clj update in (#520)

* Added implementations for update, update-in, assoc, assoc-in.

* Updated docs for new clj functions/macros.

* Fix lfe_init_SUITE ERL_LIBS to target the compiled lfe app

The suite spawns bin/lfe and set ERL_LIBS to the repo root, which is
not a valid OTP library directory for the lfe app: the compiled beams
(including lfe_init.beam) live in _build/<profile>/lib/lfe/ebin, while
the root ebin/ holds only lfe.app. bin/lfe could therefore only find
lfe_init via its fallback rebar3 path, which defaults to the `default`
profile.

CI stayed green because the builds job runs `rebar3 compile` (populating
_build/default/lib/lfe/ebin) before `make ct`. A bare `rebar3 ct` -- or
`make tests`, which cleans _build and builds only the test profile --
never populates the default profile, so lfe_init was absent from the
resolved code path and the kernel user child failed with
{undef,[{lfe_init,start,[],[]}...]}.

Derive ERL_LIBS from the running app instead: the parent of
code:lib_dir('lfe') is the actual _build/<profile>/lib dir containing
the compiled lfe app, making the suite independent of which rebar3
profile happens to be pre-built. bin/lfe is still located from the repo
root as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Signed-off-by: Maciej Barć <[email protected]>
Co-authored-by: Maciej Barć <[email protected]>
Co-authored-by: Bruno Dias <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lfe -eval Crash on OTP 28: user_drv {badkey, input}

3 participants