Skip to content

kernel: Remove redundant check of initial code path#11350

Open
ausimian wants to merge 1 commit into
erlang:masterfrom
ausimian:kernel/code-server-startup-path
Open

kernel: Remove redundant check of initial code path#11350
ausimian wants to merge 1 commit into
erlang:masterfrom
ausimian:kernel/code-server-startup-path

Conversation

@ausimian

Copy link
Copy Markdown
Contributor

Description

When the code server starts in interactive mode, it builds the initial
code path before calling add_loader_path/2:

  • $ROOT/lib entries, produced by make_path/2
  • ERL_LIBS entries, also produced by make_path/2 (filtered to ebin
    directories)
  • a trailing "."

Every entry emitted by make_path/2 has already passed an is_dir/1
check — either the application's ebin directory or an archive fallback
chosen by try_ebin_dirs/1 — and bundles without a usable directory are
dropped. add_loader_path/2 nevertheless ran patch_path/1 over this
list, validating each entry a second time during startup.

That second pass cannot change the list: entries that exist are kept
as-is, and the trailing "." is kept in either case because
patch_path/1 returns its input unchanged when check_path/1 fails. In
embedded mode the initial path is empty. This change uses the initial
path as built instead of validating it again.

Testing

  • kernel code_SUITE passes (57/57) with the change.
  • Smoke-tested that code:get_path() is as expected on a patched build:
    ERL_LIBS applications are present and "." remains the last entry.
  • Patched builds boot correctly on macOS (Apple Silicon) and Linux
    (x86_64, Ubuntu 24.04).

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

    2 files     74 suites   1h 10m 17s ⏱️
1 805 tests 1 384 ✅ 420 💤 1 ❌
2 057 runs  1 578 ✅ 478 💤 1 ❌

For more details on these failures, see this check.

Results for commit 4ffd26b.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@ausimian ausimian force-pushed the kernel/code-server-startup-path branch from 65bbb8d to 65e0aa6 Compare July 13, 2026 08:36
@tommyOTP tommyOTP added the team:VM Assigned to OTP team VM label Jul 13, 2026
The initial application code path is built by make_path/2, which
already checks generated ebin directories. Reuse that path in
add_loader_path/2 rather than validating it a second time during code
server startup.
@ausimian ausimian force-pushed the kernel/code-server-startup-path branch from 65e0aa6 to 4ffd26b Compare July 14, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:VM Assigned to OTP team VM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants