Skip to content

Quote variables in entrypoint.sh test conditions#628

Merged
giohappy merged 2 commits into
GeoNode:masterfrom
Valyrian-Code:fix/entrypoint-quote-test-vars
Jun 17, 2026
Merged

Quote variables in entrypoint.sh test conditions#628
giohappy merged 2 commits into
GeoNode:masterfrom
Valyrian-Code:fix/entrypoint-quote-test-vars

Conversation

@Valyrian-Code

Copy link
Copy Markdown
Contributor

Problem

entrypoint.sh compares unquoted variables in [ ] tests:

if [ ${FORCE_REINIT} = "true" ]  || [ ${FORCE_REINIT} = "True" ] || ...

FORCE_REINIT is not set in .env.sample (only mentioned in a comment), so on a normal django container start it is unset and the test becomes [ = "true" ], which errors:

[: =: unary operator expected

The || chain falls through to the lock-file check, so initialization still works — but the error is printed on every startup, and the FORCE_REINIT toggle is fragile (an empty value errors instead of comparing as a string). The same unquoted pattern is used for INVOKE_LOG_STDOUT (line 8) and IS_CELERY (line 32).

Fix

Quote the compared variables so an empty/unset value compares cleanly:

if [ "${FORCE_REINIT}" = "true" ]  || [ "${FORCE_REINIT}" = "True" ] || ...

Verification

  • bash -n entrypoint.sh passes.
  • With FORCE_REINIT unset: the unquoted form prints [: =: unary operator expected; the quoted form evaluates to false with no error.

FORCE_REINIT is not set in .env.sample (only referenced in a comment), so
on a normal start '[ ${FORCE_REINIT} = "true" ]' runs as '[ = "true" ]'
and errors with '[: =: unary operator expected'. The || chain falls through
to the lock-file check so init still works, but the error is printed on
every startup and the toggle is fragile. Quote the compared variables (also
INVOKE_LOG_STDOUT and IS_CELERY) so an empty value compares cleanly.
Copilot AI review requested due to automatic review settings June 11, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@giohappy giohappy requested a review from mattiagiupponi June 15, 2026 09:41
@giohappy giohappy merged commit abebfbb into GeoNode:master Jun 17, 2026
6 checks passed
@Valyrian-Code Valyrian-Code deleted the fix/entrypoint-quote-test-vars branch June 17, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants