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

Issue Report: Dialyzer Warnings and Common Test Failures #4250

Open
rupeshbasha opened this issue Jul 8, 2024 · 1 comment
Open

Issue Report: Dialyzer Warnings and Common Test Failures #4250

rupeshbasha opened this issue Jul 8, 2024 · 1 comment

Comments

@rupeshbasha
Copy link

When running Dialyzer and common tests on the current ejabberd codebase, I encountered several warnings and test failures. The following are the details of the issues:

Dialyzer Warnings

File: src/ejabberd_sip.erl

1.	Line 37 Column 1: Function accept/1 has no local return
2.	Line 39 Column 1: Function listen_options/0 has no local return
3.	Line 41 Column 1: Function start/3 has no local return
4.	Line 43 Column 1: Function start_link/3 has no local return

File: src/mod_avatar.erl

1.	Line 107 Column 2: The pattern {'ok', MimeType, Data} can never match the type 'pass' | {'error','too_many_requests' | 'unsupported_format'}
2.	Line 284 Column 5: The pattern {'ok', ImgInfo} can never match the type {'error','too_many_requests' | 'unsupported_format'}
3.	Line 349 Column 3: The pattern {'ok', NewData} can never match the type {'error','too_many_requests' | 'unsupported_format'}
4.	Line 434 Column 1: Function encode_mime_type/1 will never be called
5.	Line 441 Column 2: The variable Formats can never match since previous clauses completely covered the type []

File: src/mod_http_upload.erl

1.	Line 191 Column 5: The pattern [_ | _] can never match the type []
2.	Line 544 Column 3: The pattern {'ok', Headers, OutData} can never match the type {'error',_}
3.	Line 1001 Column 3: The pattern {'ok', Data, MediaInfo} can never match the type 'pass'
4.	Line 1111 Column 3: The pattern {'ok', Info} can never match the type {'error','too_many_requests' | 'unsupported_format'}
5.	Line 1130 Column 1: Function convert/2 will never be called
6.	Line 1164 Column 1: Function thumb_el/2 will never be called

Common Test Failures

Command: rebar3 ct

Output:

•	Failed 1 test
•	Skipped 1170 tests (1168, 2)
•	Passed 415 tests
•	Failures occurred running tests: 3

Steps to Reproduce

1.	Run rebar3 dialyzer to reproduce the Dialyzer warnings.
2.	Run rebar3 ct to reproduce the common test failures.

Environment

    -     Ejabberd version: 24.06
    -     Erlang/OTP Version: 25 [erts-13.2.2.9]
    -     Operating system: Linux and Mac
    -     Installed from: source 

Expected Behavior

Dialyzer should pass without warnings, and all tests should pass without failures or unexpected skips.

@badlop
Copy link
Member

badlop commented Jul 8, 2024

ejabberd has optional features, some of them disabled by default. But Dialyzer obviously checks all the code, even the one that depends on features that may be disabled by default.

For that reason, if you plan to run xref, dialyzer, tests... you should enable all the features:

./configure --enable-all

You can see that in

--enable-all \


...

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

No branches or pull requests

2 participants