Skip to content

rebar_prv_compile:copy/2 crashes with badmatch {error, eperm} #3000

Description

@TreySargent

After compiling and installing rebar3 from source, running rebar3 compile on a project fails with an uncaught error originating in rebar_prv_compile:copy/2. The error is a badmatch on {error, eperm}, which indicates a permission error returned by a file operation (likely file:copy / filelib usage) that is not being handled defensively.

This appears similar to a prior issue we observed around copy/2 in rebar_prv_compile on Windows, where eperm (or transient sharing violations) could occur when copying from _build or apps/* directories—possibly due to Windows file locking semantics or antivirus interference.

Environment
OS: Windows 11
Shell: PowerShell / cmd (local)
rebar3: freshly compiled from source (please add rebar3 --version output)
Erlang/OTP: OTP 27

Steps to Reproduce
Compile and install rebar3 from source on Windows 11.
In a project with apps/*, run:
rebar3 compile

Observe the crash during the “copy/build project apps” phase.

Expected Result
rebar3 compile completes successfully; project apps are copied/built without file permission errors.

Actual Result
rebar3 crashes in rebar_core with an uncaught badmatch on {error, eperm} from rebar_prv_compile:copy/2.

Console Output (excerpt)

===> Running providers: compile
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Running hooks for compile with configuration:
    pre_hooks, []
===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult _build/default/logs/rebar3.crashdump
===> Uncaught error: {badmatch,{error,eperm}}
===> Stack trace to the error location:
[{rebar_prv_compile,copy,2,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~590-601}]},
 {rebar_prv_compile,copy_app_dirs,3,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~460-470}]},
 {rebar_prv_compile,prepare_project_app,3,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~160-170}]},
 {rebar_prv_compile,copy_and_build_project_apps,3,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~80-140}]},
 {rebar_prv_compile,compile_project_apps,2,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~110-130}]},
 {rebar_prv_compile,do,1,
  [{file,"c:/Users/nobel.sargent/Source/rebar3/apps/rebar/src/rebar_prv_compile.erl"},
   {line, ~510-530}]}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions