Skip to content

Conversation

@ilya-klyuchnikov
Copy link
Contributor

@ilya-klyuchnikov ilya-klyuchnikov commented Jul 11, 2025

  1. Remove MF clauses - those are just crashing
1> erlang:spawn_link({erlang, self}).
=ERROR REPORT==== 11-Jul-2025::10:00:24.949585 ===
Error in process <0.90.0> with exit value:
{{badfun,{erlang,self}},[{erlang,apply,2,[]}]}

** exception exit: {badfun,{erlang,self}}
     in function  apply/2

2> erlang:spawn_link(erlang:node(), {erlang, self}).
=ERROR REPORT==== 11-Jul-2025::10:13:09.738964 ===
Error in process <0.89.0> with exit value:
{{badfun,{erlang,self}},[{erlang,apply,2,[]}]}

** exception exit: {badfun,{erlang,self}}
     in function  apply/2
  1. More precise guards: is_function(F) -> is_function(F, 0)
  2. More precise types

Bad code found by eqwalizer.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2025

CT Test Results

    3 files    142 suites   49m 40s ⏱️
1 649 tests 1 592 ✅ 57 💤 0 ❌
2 372 runs  2 295 ✅ 77 💤 0 ❌

Results for commit 708dbcb.

♻️ 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

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jul 14, 2025
Copy link
Contributor

@jhogberg jhogberg left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This is a rather funny one as the usage doesn't crash the caller. It crashes the spawned process, so from the caller's point of view the spawning of the process was a success. Fixing this could break strange but otherwise working code. I don't expect that to be a problem but it's something we need to discuss internally.

Edit: we'll merge this to master soon.

Comment on lines -10462 to -10463
spawn_link({M,F}=MF) when erlang:is_atom(M), erlang:is_atom(F) ->
erlang:spawn_link(erlang, apply, [MF, []]);
Copy link
Contributor

@jhogberg jhogberg Jul 14, 2025

Choose a reason for hiding this comment

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

As an aside the {M, F} form is a holdover from when funs were tuples. This 2-tuple form was used to represent exported functions (fun M:F/A), and worked all the way until ~R15 in 2011.

@jhogberg jhogberg self-assigned this Jul 14, 2025
@jhogberg jhogberg added the testing currently being tested, tag is used by OTP internal CI label Jul 14, 2025
@jhogberg jhogberg removed the testing currently being tested, tag is used by OTP internal CI label Jul 17, 2025
@jhogberg jhogberg merged commit 368884c into erlang:master Oct 6, 2025
28 of 29 checks passed
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.

3 participants