Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named functions not properly escaped when written to sys.config #9231

Closed
tanguilp opened this issue Jul 20, 2019 · 2 comments

Comments

@tanguilp
Copy link

commented Jul 20, 2019

Environment

  • Elixir & Erlang/OTP versions (elixir --version): 1.9.0 / OTP21
  • Operating system: Linux

Current behavior

When using named function in configuration files, generating a release fails with the following error message.

Configuration file example:

prod.exs

config :asteroid, :token_store_refresh_token_before_store_callback,
  &Asteroid.Utils.id_first_param/2

Error message:

$ MIX_ENV=prod mix release
Compiling 88 files (.ex)
Generated asteroid app
* assembling prod-0.1.0 on MIX_ENV=prod
* skipping runtime configuration (config/releases.exs not found)
** (Mix) Could not read configuration file. It likely has invalid configuration terms such as functions, references, and pids. Please make sure your configuration is made of numbers, atoms, strings, maps, tuples and lists. Reason: {22, :erl_parse, ['syntax error before: ', '\'.\'']}

(from https://github.com/elixir-lang/elixir/blob/master/lib/mix/lib/mix/release.ex#L368)

Expected behavior

Named functions can used in configuration files.

Root cause

When generating a release, named functions are not properly escaped. Example:

{token_store_refresh_token_before_store_callback, fun Elixir.Asteroid.Utils:id_first_param/2},

instead of:

{token_store_refresh_token_before_store_callback, fun 'Elixir.Asteroid.Utils':id_first_param/2},
@josevalim

This comment has been minimized.

Copy link
Member

commented Jul 20, 2019

Thanks, Erlang bug filled here! https://bugs.erlang.org/browse/ERL-1009

@josevalim

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

A fix has been merged in OTP, thanks for the report!

@josevalim josevalim closed this Aug 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.