apache / apache/couchdb

Dialyzer warnings do not always show up

Open
#4,548 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

The `dialyze` target does not always return any Dialyzer warnings, for instance:

```console
make dialyze apps=mango
==> mango (build-plt)
WARN: ''build-plt'' command does not apply to directory /Users/gaborpali/projects/github/couchdb/rel
WARN: ''build-plt'' command does not apply to directory /Users/gaborpali/projects/github/couchdb
==> mango (dialyze)
WARN: 'dialyze' command does not apply to directory /Users/gaborpali/projects/github/couchdb/rel
WARN: 'dialyze' command does not apply to directory /Users/gaborpali/projects/github/couchdb
```

While, at the same time, if Dialyzer is invoked in different way, reasonable findings are reported:

```console
$ dialyzer --build_plt --apps erts kernel stdlib mnesia
Creating PLT /Users/gaborpali/.dialyzer_plt ...
Unknown functions:
compile:file/2 (c.erl:385:10)
compile:forms/2 (escript.erl:204:10)
compile:noenv_forms/2 (erl_abstract_code.erl:10:9)
compile:noenv_forms/2 (qlc_pt.erl:444:14)
compile:output_generated/1 (c.erl:444:10)
crypto:crypto_one_time/5 (beam_lib.erl:987:11)
crypto:start/0 (beam_lib.erl:1023:10)
crypto:strong_rand_bytes/1 (net_kernel.erl:1918:37)
Unknown types:
compile:option/0 (c.erl:92:19)
compile:option/0 (erl_expand_records.erl:41:26)
compile:option/0 (erl_lint.erl:50:47)
compile:option/0 (qlc.erl:541:32)
compile:option/0 (qlc_pt.erl:73:32)
done in 0m21.58s
done (passed successfully)
$ dialyzer `find src -name ebin -depth 2`
Checking whether the PLT /Users/gaborpali/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
[..]
mango_crud.erl:40:9: The pattern
{'accepted', Results0} can never match the type
{'aborted', _}
[..]
```

Maybe that is just Mango, but it is possible that there are similar cases. Investigate the causes and fix `make dialyze`.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `make dialyze apps=mango`, then compare its behavior with the direct Dialyzer commands shown in the report. Trace the `dialyze` target and the Mango build output, including `src` and `ebin` paths; done means `make dialyze` consistently reports applicable Dialyzer warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.