[erlang-questions] relups and file handlers

Ignas Vyšniauskas baliulia@REDACTED
Fri Dec 28 08:47:04 CET 2012


Hi Erlangers,

I am about to do something nasty, so I wanted to ask you "how nasty you
think this is".

Due to technical reasons I want to do a relup in this way:

1. I have a release of `foobar` running from $SOMEPATH/foobar/
2. I deploy new release binaries by completely removing
$SOMEPATH/foobar/ and overrwriting them with the new ones
3. In addition, I include some old_vsn_to_new_vsn_relup.tar.gz which
contains upgrade code.
4. Now I want to do the usual rebar-style relup using
./foobar/bin/foobar upgrade old_vsn_to_new_vsn_relup

It all works fine, except for the fact that since $SOMEPATH/foobar/ gets
deleted, the Erlang file_server has an invalid file handler for the CWD
and thus file:get_cwd() fails and therefore `erl_untar.erl` fails trying
to extract the .tar.gz relup archive.

I managed to easily fix this by doing file:set_cwd/1. My quesion: is
this safe? Perhaps other applications still have some invalid file
handlers and I will start bumping into mysterious issues later?

All hints/ideas are very appreciated.

Ignas

P.S. Note however that I don't care about any other issues:
downgrades/keeping a release history/whatever, in this particular case
it's of no interest and not a problem.



More information about the erlang-questions mailing list