bitwalker / exrm

Automatically generate a release for your Elixir project!
MIT License
924 stars 110 forks source link

RELX_REPLACE_OS_VARS boot script fails on awk with env vars containing certain characters #390

Closed novaugust closed 8 years ago

novaugust commented 8 years ago

we had an environment variable, export DB_PASSWORD='Pntu>x9hC<6&zX:e' that prevented the boot script from getting anywhere, freezing in this area

if [ $RELX_REPLACE_OS_VARS ]; then
    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < $SYS_CONFIG > $SYS_CONFIG.2.config
    SYS_CONFIG=$SYS_CONFIG.2.config
fi

source on GH

changing to another password fixed the script and got our app up and running.

bitwalker commented 8 years ago

Interesting, I'll have to dig in to awk a bit to figure out why it's choking on that string. Thanks for reporting!

novaugust commented 8 years ago

Just had this happen with another password. Seems like the bad character is the &

bitwalker commented 8 years ago

@novaugust I fixed this in distillery, but haven't yet ported the fix to exrm. You can see the commit where I did so referenced above. I'll push the fix to exrm as soon as I'm able.