Skip to content

Internal Error when running twice as provider hook from alias #329

@Alberdi

Description

@Alberdi

I've got a project where I want to automatically format the code when compiling, so I've added erlfmt as a provider hook. I didn't have any issues with this flow until I added an alias that runs ct and cover. In that case I always get an "Internal Error".

I can provide a minimal example that displays the bug:

ᐅ rebar3 -v 
rebar 3.17.0 on Erlang/OTP 23 Erts 11.2.2.2

ᐅ rebar3 new lib erlfmt_bug
===> Writing erlfmt_bug/src/erlfmt_bug.erl
===> Writing erlfmt_bug/src/erlfmt_bug.app.src
===> Writing erlfmt_bug/rebar.config
===> Writing erlfmt_bug/.gitignore
===> Writing erlfmt_bug/LICENSE
===> Writing erlfmt_bug/README.md

ᐅ cd erlfmt_bug

ᐅ echo '
{project_plugins, [erlfmt]}.

{erlfmt, [write]}.

{provider_hooks, [
    {pre, [{compile, fmt}]}
]}.

{alias, [
    {test, [
        {ct, "--cover"},
        {cover, "-m 100"}
    ]}
]}.
' >> rebar.config

ᐅ rebar3 test
[...]
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling erlfmt_bug
===> Running Common Test suites...
All 0 tests passed.
===> Verifying dependencies...
rebar3 fmt Internal Error
exit:normal
[{erlfmt_cli,parallel_loop,5,
             [{file,"/Users/marcelino/Developer/erlfmt_bug/_build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,484}]},
 {erlfmt_cli,unprotected_with_config,2,
             [{file,"/Users/marcelino/Developer/erlfmt_bug/_build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,128}]},
 {erlfmt_cli,with_parsed,2,
             [{file,"/Users/marcelino/Developer/erlfmt_bug/_build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,104}]},
 {rebar3_fmt_prv,do,1,
                 [{file,"/Users/marcelino/Developer/erlfmt_bug/_build/default/plugins/erlfmt/src/rebar3_fmt_prv.erl"},
                  {line,43}]},
 {rebar_core,do,2,
             [{file,"/home/runner/work/rebar3/rebar3/src/rebar_core.erl"},
              {line,155}]},
 {rebar_hooks,run_provider_hooks_,6,
              [{file,"/home/runner/work/rebar3/rebar3/src/rebar_hooks.erl"},
               {line,70}]},
 {rebar_hooks,run_all_hooks,6,
              [{file,"/home/runner/work/rebar3/rebar3/src/rebar_hooks.erl"},
               {line,18}]},
 {rebar_prv_compile,'-compile/4-lc$^0/1-0-',3,
                    [{file,"/home/runner/work/rebar3/rebar3/src/rebar_prv_compile.erl"},
                     {line,151}]}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions