Skip to content

Conversation

tianon
Copy link
Member

@tianon tianon commented Oct 12, 2017

This is roughly equivalent to using var_export in PHP. 😄 The end result of this simple erl one-liner is that it takes a single argument and returns a copy of it safely Erlang-quoted:

root@7ef63acdb2cd:/# erl -noinput -eval 'io:format("~p\n", init:get_plain_arguments()), init:stop().' -- $'a\nb\tc\t"\t\nd'
"a\nb\tc\t\"\t\nd"

Closes #199

I've verified that the result of RABBITMQ_DEFAULT_PASS=$'a\nb\nc' becomes { default_pass, <<"a\nb\nc">> }, as expected (and RabbitMQ starts up successfully). I'm not sure whether newlines in a password actually makes any sense, but it might for other values, and this insulates us completely against needing to worry about specific characters or validation.

@yosifkit yosifkit merged commit 1221ea6 into docker-library:master Oct 12, 2017
@yosifkit yosifkit deleted the escape-strings branch October 12, 2017 20:30
tianon added a commit to infosiftr/stackbrew that referenced this pull request Oct 13, 2017
- `docker`: add client-only Windows variants (docker-library/docker#75)
- `ghost`: 0.11.12
- `rabbitmq`: escape special characters in config (docker-library/rabbitmq#201)
- `redmine`: passenger 5.1.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants