Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Make entrypoint RubyMine compatible. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cleverer
Copy link
Contributor

Launch command wasn't escaped properly…

@@ -29,4 +29,4 @@ fi
echo "➡️ Handing control over to '$*''"

# shellcheck disable=SC2068
exec bundle exec $@
exec bundle exec "$@"
Copy link
Member

@cimnine cimnine Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 It was intentionally not quoted. Calling the script like .docker/entrypoint somecommand -with -some -arguments would result in a command like that:

exec bundle exec "somecommand -with -some -arguments"

I.e. bash won't split the string into multiple arguments, but pass it as one argument. Bundler would see the following arguments:

arg[0] = 'bundle'
arg[1] = 'exec'
arg[2] = 'somecommand -with -some -arguments'

Rather than without the quotes:

arg[0] = 'bundle'
arg[1] = 'exec'
arg[2] = 'somecommand'
arg[3] = '-with'
arg[4] = '-some'
arg[5] = '-arguments'

I'm not sure if the proposed change achieves what is intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it just now in various quoting combinations, it works just fine like that (e.g. docker-compose run --rm app rails c and docker-compose run --rm app --keep-file-descriptors rails c gives me the rails shell). I think the first exec splits the arguments again, but couldn't find any documentation on it.

Without the quotes, RubyMine gets stuck at

Handing control over to 'sh -c /usr/local/bin/ruby /app/hitobito/bin/rails server -b 0.0.0.0 -p 3000 -e development''

cleverer referenced this pull request in cleverer/hitobito-docker Mar 1, 2020
Make entrypoint RubyMine compatible
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants