Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@robertoaloi
Copy link
Contributor

Today, when printing an Erlang stacktrace, we return location information in a custom (PATH, line LINE) format. E.g.:

** exception error: bad argument
     in function  lists:member/2
        called as lists:member(1,not_a_list)
        *** argument 2: not a list
     in call from test:main/0 (test.erl, line 8)

A more common notation would be /path/to/filename:line_number, which is used in many programming tools and languages to specify a location in a file. This would also be in line with what the Erlang compiler returns:

erlc test.erl
test.erl:8:16: syntax error before:
%    8|   lists:member(1
%     |                ^

While the PATH:NUMBER does not seem to be an official standard, it's a widely adopted and understood convention across various development communities.

Switching to the new format would simplify a number of tasks. For example, terminals such as iTerm would recognize this as a link and would allow developers to jump to the correct line number from terminal with a single click.

This change will most likely break some tests, but before fixing them I'm opening the PR to check how open would you be to the change.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2025

CT Test Results

    2 files     97 suites   1h 8m 46s ⏱️
2 192 tests 2 145 ✅ 47 💤 0 ❌
2 558 runs  2 509 ✅ 49 💤 0 ❌

Results for commit 14f7ccf.

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

@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Feb 24, 2025
@jhogberg jhogberg self-assigned this Feb 24, 2025
@jhogberg
Copy link
Contributor

This change will most likely break some tests, but before fixing them I'm opening the PR to check how open would you be to the change.

Go for it :-)

We can't bring this into maint, but for master it's fine. We'd love to see it in 28 RC2/3.

@robertoaloi robertoaloi changed the base branch from maint to master February 26, 2025 10:38
@robertoaloi robertoaloi force-pushed the conventional-file-locations branch from 05e4563 to 14f7ccf Compare February 26, 2025 10:41
@robertoaloi
Copy link
Contributor Author

@jhogberg It turns out there was a single test failing due to the change, so this should be ready to go from my side. I also changed the base to master as requested.

@jhogberg jhogberg added enhancement testing currently being tested, tag is used by OTP internal CI labels Feb 26, 2025
@jhogberg
Copy link
Contributor

Great, I've added it to our nightly builds. :-)

@bjorng bjorng merged commit e424f33 into erlang:master Mar 12, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants