rebar3 tar and endless loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

rebar3 tar and endless loop

Alexander Petrovsky-2
Hi!

I try to prepare erlang release, with follow config:

{relx, [
    {release, {x, "0.0.1"},
         [x,
          sasl]},
    {overlay, [
         {copy, "priv/*", "priv/"}
    ...
./rebar3 release

But, relx doesn't support wildcard. I'm try the follow config:

    ...
         {copy, "priv/", "priv/"}
    ...
./rebar3 release

Unfortunately, the result will be priv/priv. But when I do:

    ...
         {copy, "priv/", "./"}
    ...
./rebar3 release

Everything goes without problems. But, when I'm try to make tarball from that here problems come: the ./rebar3 tar goes to endless loop continuously add x-0.0.1.tar.gz to himself. 

The ./rebar3 tar keep archive tar.gz file in the same directory with generated erlang release files. So, when rebar3 sees mappings like {copy, "priv/", "./"} it's transforms them into something like

[{"./",           "/Users/juise/Documents/x/_build/default/rel/x"},
 {"log/sasl", "/Users/juise/Documents/x/_build/default/rel/x/log/sasl"}]

which cause endless loop.

I see multiple solutions:
- ./rebar3 tar must archive all files in release directory, and not pay attention to overlay directive;
- relx should ignore mappings like {"./", "/Users/juise/Documents/x/_build/default/rel/x"};
- erl_tar should explicitly ignore result archive and don't add to himself.

--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Dmitry Kolesnikov-2
Hello,

The private folder of applications are automatically added to the release. 
There are not need to add an overlay. You can move your root /priv folder under you application x.

Best Regards,
Dmitry


On 8 Nov 2017, at 0.25, Alexander Petrovsky <[hidden email]> wrote:

Hi!

I try to prepare erlang release, with follow config:

{relx, [
    {release, {x, "0.0.1"},
         [x,
          sasl]},
    {overlay, [
         {copy, "priv/*", "priv/"}
    ...
./rebar3 release

But, relx doesn't support wildcard. I'm try the follow config:

    ...
         {copy, "priv/", "priv/"}
    ...
./rebar3 release

Unfortunately, the result will be priv/priv. But when I do:

    ...
         {copy, "priv/", "./"}
    ...
./rebar3 release

Everything goes without problems. But, when I'm try to make tarball from that here problems come: the ./rebar3 tar goes to endless loop continuously add x-0.0.1.tar.gz to himself. 

The ./rebar3 tar keep archive tar.gz file in the same directory with generated erlang release files. So, when rebar3 sees mappings like {copy, "priv/", "./"} it's transforms them into something like

[{"./",           "/Users/juise/Documents/x/_build/default/rel/x"},
 {"log/sasl", "/Users/juise/Documents/x/_build/default/rel/x/log/sasl"}]

which cause endless loop.

I see multiple solutions:
- ./rebar3 tar must archive all files in release directory, and not pay attention to overlay directive;
- relx should ignore mappings like {"./", "/Users/juise/Documents/x/_build/default/rel/x"};
- erl_tar should explicitly ignore result archive and don't add to himself.

--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Alexander Petrovsky-2
Hi!

Sorry, the priv folder was just for example, for other user folders the problem is still take a place. Would be great to hear rebar3 maintainers opinion.

ср, 8 нояб. 2017 г. в 11:44, Dmitry Kolesnikov <[hidden email]>:
Hello,

The private folder of applications are automatically added to the release. 
There are not need to add an overlay. You can move your root /priv folder under you application x.

Best Regards,
Dmitry


On 8 Nov 2017, at 0.25, Alexander Petrovsky <[hidden email]> wrote:

Hi!

I try to prepare erlang release, with follow config:

{relx, [
    {release, {x, "0.0.1"},
         [x,
          sasl]},
    {overlay, [
         {copy, "priv/*", "priv/"}
    ...
./rebar3 release

But, relx doesn't support wildcard. I'm try the follow config:

    ...
         {copy, "priv/", "priv/"}
    ...
./rebar3 release

Unfortunately, the result will be priv/priv. But when I do:

    ...
         {copy, "priv/", "./"}
    ...
./rebar3 release

Everything goes without problems. But, when I'm try to make tarball from that here problems come: the ./rebar3 tar goes to endless loop continuously add x-0.0.1.tar.gz to himself. 

The ./rebar3 tar keep archive tar.gz file in the same directory with generated erlang release files. So, when rebar3 sees mappings like {copy, "priv/", "./"} it's transforms them into something like

[{"./",           "/Users/juise/Documents/x/_build/default/rel/x"},
 {"log/sasl", "/Users/juise/Documents/x/_build/default/rel/x/log/sasl"}]

which cause endless loop.

I see multiple solutions:
- ./rebar3 tar must archive all files in release directory, and not pay attention to overlay directive;
- relx should ignore mappings like {"./", "/Users/juise/Documents/x/_build/default/rel/x"};
- erl_tar should explicitly ignore result archive and don't add to himself.

--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Alexander Petrovsky-2


2017-11-08 16:25 GMT+03:00 Kostis Sagonas <[hidden email]>:
On 11/08/2017 11:36 AM, Alexander Petrovsky wrote:
Would be great to hear rebar3 maintainers opinion.

Why don't you send this as an issue in rebar3's repo then?

Kostis

It's not only rebar3 problem. If you read the letter, you should notice, the problem occur in erl_tar.


--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Tristan Sloughter-4
So the issue is simply the use of copying to `./` as opposed to `./somedir`, right?

Certainly an issue, easy fix is to put it under another diectory, since you can't access it with `code:priv_dir` anyway since it isn't under an application no reason not to do `{copy, "priv", "etc/"}` but you probably already did that.

I'd like to see the fix, if possible, in erl_tar but I'd have to take a closer look to know for sure if that is possible and what it would be. Not sure when I'll get time to dig in.

--
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson


On Wed, Nov 8, 2017, at 07:52 AM, Alexander Petrovsky wrote:


2017-11-08 16:25 GMT+03:00 Kostis Sagonas <[hidden email]>:
On 11/08/2017 11:36 AM, Alexander Petrovsky wrote:
Would be great to hear rebar3 maintainers opinion.

Why don't you send this as an issue in rebar3's repo then?

Kostis

It's not only rebar3 problem. If you read the letter, you should notice, the problem occur in erl_tar.


--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991

_______________________________________________
erlang-questions mailing list


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Alexander Petrovsky-2


2017-11-08 19:12 GMT+03:00 Tristan Sloughter <[hidden email]>:
So the issue is simply the use of copying to `./` as opposed to `./somedir`, right?

Exactly!
 

Certainly an issue, easy fix is to put it under another diectory, since you can't access it with `code:priv_dir` anyway since it isn't under an application no reason not to do `{copy, "priv", "etc/"}` but you probably already did that.

I'd like to see the fix, if possible, in erl_tar but I'd have to take a closer look to know for sure if that is possible and what it would be. Not sure when I'll get time to dig in.

I'm agree that it's will be perfect to fix the problem in erl_tar, but as quick fix we can ignore ./ mapping in https://github.com/erlware/relx/blob/master/src/rlx_prv_archive.erl#L111, and teach overlay_files ignore ./ mappings
 

--
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson


On Wed, Nov 8, 2017, at 07:52 AM, Alexander Petrovsky wrote:


2017-11-08 16:25 GMT+03:00 Kostis Sagonas <[hidden email]>:
On 11/08/2017 11:36 AM, Alexander Petrovsky wrote:
Would be great to hear rebar3 maintainers opinion.

Why don't you send this as an issue in rebar3's repo then?

Kostis

It's not only rebar3 problem. If you read the letter, you should notice, the problem occur in erl_tar.


--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991

_______________________________________________
erlang-questions mailing list


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions




--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: rebar3 tar and endless loop

Tristan Sloughter-4
But if it ignores it won't you just not get your files in the tarball?

--
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson


On Wed, Nov 8, 2017, at 08:46 AM, Alexander Petrovsky wrote:


2017-11-08 19:12 GMT+03:00 Tristan Sloughter <[hidden email]>:

So the issue is simply the use of copying to `./` as opposed to `./somedir`, right?

Exactly!
 


Certainly an issue, easy fix is to put it under another diectory, since you can't access it with `code:priv_dir` anyway since it isn't under an application no reason not to do `{copy, "priv", "etc/"}` but you probably already did that.

I'd like to see the fix, if possible, in erl_tar but I'd have to take a closer look to know for sure if that is possible and what it would be. Not sure when I'll get time to dig in.

I'm agree that it's will be perfect to fix the problem in erl_tar, but as quick fix we can ignore ./ mapping in https://github.com/erlware/relx/blob/master/src/rlx_prv_archive.erl#L111, and teach overlay_files ignore ./ mappings
 


--
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson


On Wed, Nov 8, 2017, at 07:52 AM, Alexander Petrovsky wrote:


2017-11-08 16:25 GMT+03:00 Kostis Sagonas <[hidden email]>:
On 11/08/2017 11:36 AM, Alexander Petrovsky wrote:
Would be great to hear rebar3 maintainers opinion.

Why don't you send this as an issue in rebar3's repo then?

Kostis

It's not only rebar3 problem. If you read the letter, you should notice, the problem occur in erl_tar.


--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list



_______________________________________________
erlang-questions mailing list




--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions