Cookiecutter-django: entrypoint script uses Bash features despite POSIX shell shebang

Created on 5 Dec 2019  Â·  4Comments  Â·  Source: pydanny/cookiecutter-django

What happened?

At …
https://github.com/pydanny/cookiecutter-django/blob/efbf164e84998a8d450133bd00c14c07b25bf8c4/%7B%7Bcookiecutter.project_slug%7D%7D/compose/production/django/entrypoint#L1
… it reads #!/bin/sh so the script has no guarantee to deal with Bash (and not just a POSIX shell) but then uses Bash features, e.g. set -o pipefail.

What should've happened instead?

I would expect

  • a) use of #! /usr/bin/env bash or
  • b) a true POSIX shell script without use of Bashisms

Thank you!

bug

Most helpful comment

Hello,
I've recently changed my django/dockerfile from alpine to python:3.7-slim-buster.
When i try to run docker-compose -f local.yml up , appears the following error:

django_1 | /entrypoint: 4: set: Illegal option -o pipefail

do you know why occur this?

All 4 comments

As far as I remember, we intended to use sh because bash isn't installed in the alpine image we use. Feel free to send a pull request to cleanup the "bashism".

Hello,
I've recently changed my django/dockerfile from alpine to python:3.7-slim-buster.
When i try to run docker-compose -f local.yml up , appears the following error:

django_1 | /entrypoint: 4: set: Illegal option -o pipefail

do you know why occur this?

do you know why occur this?

Because /bin/sh in Debian buster understands set -o errexit and applies it and then set -o pipefail not only fails loudly but also exits the shell.

This problem now fixed, our bash scripts are using bash shebang, so I'll close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saschalalala picture saschalalala  Â·  4Comments

bluesurfer picture bluesurfer  Â·  4Comments

webyneter picture webyneter  Â·  4Comments

japrogramer picture japrogramer  Â·  4Comments

webyneter picture webyneter  Â·  3Comments