erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

relx:main with {include_erts,true} fails on Darwin #564

Closed massemanet closed 7 years ago

massemanet commented 7 years ago

OTP 18.3 installed with brew.

1> relx:main([{lib_dirs,[".../_build/default/lib"]},{config,[{overlay,[]},{release,{reporter,{semver,[]}},[sasl,appenv,reporter,eper]},{dev_mode,false},{include_erts,true},{sys_config,"rel/sys.config"},{vm_args,"rel/vm.args"},{extended_start_script,true}]},{caller,api},{log_level,2},{output_dir,".../_build/default/rel"}],"release").
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
.../_build/default/lib
/usr/local/Cellar/erlang/18.3/lib/erlang/lib
.../_build/default/rel
===> Resolved reporter-3.22.2+build.4.ref2640387
** exception error: no function clause matching relx:format_error({error,eacces}) (.../relx/_build/default/lib/relx/src/relx.erl, line 220)
     in function  relx:report_error/2 (.../relx/_build/default/lib/relx/src/relx.erl, line 336)
commit 2640387cf1ba24682690b5d6f488df3d8ded5501
Merge: 40f9743 65096ac
Author: Luis Rascão <luis.rascao@gmail.com>
Date:   Wed Jan 11 18:11:50 2017 +0000
$ uname -a
Darwin brill.local 16.4.0 Darwin Kernel Version 16.4.0
lrascao commented 7 years ago

do you get the same error if you specify {include_erts, false} ?

massemanet commented 7 years ago

no, that works.

but I do have some more info. brew (a Darwin package manager) installs the OTP files read-only. when relx copies the .app files (because include_erts), it preserves the file permissions. So when relx tries to overwrite its own copies of the .app files, it fails because the files are read-only.

jaromirmuller commented 7 years ago

I have same problem. When I try to run rebar3 as prod tar then it fails on

$ rebar3 report "rebar3 as prod tar"
Rebar3 report
 version 3.3.4
 generated at 2017-01-28T18:57:21+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: rebar3
Entered as:
  rebar3 as prod tar
-----------------
Operating System: x86_64-apple-darwin13.4.0
ERTS: Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Root Directory: /usr/local/Cellar/erlang/19.1/lib/erlang
Library directory: /usr/local/Cellar/erlang/19.1/lib/erlang/lib
$ cat rebar3.crashdump
Error: function_clause
[{relx,format_error,
       [{error,eacces}],
       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,220}]},
 {relx,report_error,2,
       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,336}]},
 {rebar_relx,do,4,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_relx.erl"},
              {line,38}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]},
 {rebar_prv_do,do_tasks,2,
               [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_do.erl"},
                {line,57}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]},
 {rebar3,main,1,
         [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl"},
          {line,66}]},
 {init,start_em,1,[]}]
lrascao commented 7 years ago

@massemanet @jaromirmuller can you please try out #565? it should fix the issue

massemanet commented 7 years ago

I tried https://github.com/erlware/relx/pull/565; solves my problem.

Having said that, I find the behavior of ec_file:copy/3 (used in rlx_prv_assembler:copy_dir) baffling. It tries to set the file owner to its original value. Why is that ever a good idea? And how is it supposed to work if I run relx as a normal user, but the original file is owned by root (like on a debian machine)?