Conversation
Some caller systems do not seem to obey the [SHELL instruction](https://docs.docker.com/reference/dockerfile/#shell). fix FreshRSS#7859 (comment) fix FreshRSS#5611 fix FreshRSS#7267
Docker/Dockerfile
Outdated
| CMD ([ -z "$CRON_MIN" ] || cron) && \ | ||
| . /etc/apache2/envvars && \ | ||
| exec apache2 -D FOREGROUND $([ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ] && echo '-D OIDC_ENABLED') | ||
| CMD sh -c '[ -z "$CRON_MIN" ] || cron; . /etc/apache2/envvars; if [ "${OIDC_ENABLED:-0}" -ne 0 ]; then exec apache2 -D FOREGROUND -D OIDC_ENABLED; else exec apache2 -D FOREGROUND; fi' |
There was a problem hiding this comment.
Nothing in that command is Bash syntax so I'd rather not rewrite the command without the && to fail early for example.
There was a problem hiding this comment.
Or put another way, you could just change the SHELL command to /bin/sh.
There was a problem hiding this comment.
I wouldn't be inclined to edit anything at all.
You might phrase that as:
| CMD sh -c '[ -z "$CRON_MIN" ] || cron; . /etc/apache2/envvars; if [ "${OIDC_ENABLED:-0}" -ne 0 ]; then exec apache2 -D FOREGROUND -D OIDC_ENABLED; else exec apache2 -D FOREGROUND; fi' | |
| CMD sh -c '([ -z "$CRON_MIN" ] || cron) && . /etc/apache2/envvars && exec apache2 -D FOREGROUND $([ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ] && echo "-D OIDC_ENABLED")' |
But in doing so I just realized something. Naturally I had to change echo '-D OIDC_ENABLED' to make that work, which might indicate they're not ignoring the SHELL instruction but are astoundingly bad at escaping, because it'd need to become either \' or " to work as part of -c (or vice versa if you use -c "").
Which suggests that maybe you just need to change the quotes:
| CMD sh -c '[ -z "$CRON_MIN" ] || cron; . /etc/apache2/envvars; if [ "${OIDC_ENABLED:-0}" -ne 0 ]; then exec apache2 -D FOREGROUND -D OIDC_ENABLED; else exec apache2 -D FOREGROUND; fi' | |
| CMD ([ -z "$CRON_MIN" ] || cron) && \ | |
| . /etc/apache2/envvars && \ | |
| exec apache2 -D FOREGROUND $([ -n "$OIDC_ENABLED" ] && [ "$OIDC_ENABLED" -ne 0 ] && echo "-D OIDC_ENABLED") |
Because if you don't do that, the error you'll see is of course:
Syntax error: end of file unexpected (expecting ")")
Which I believe is the exact error in the referenced issue.
There was a problem hiding this comment.
In fact on closer inspection, the specific form of the error from #7859 (comment)
OIDC_ENABLED): -c: line 2: unexpected EOF while looking for matching `)'
is how Bash presents that syntax error! The one I quoted above was from Dash.
There was a problem hiding this comment.
Ok, could be good to test with one of the failing systems
|
Ok, now it only boils down to changing the quotes, which should be safe enough to merge |
Some caller systems do not seem to obey the SHELL instruction (or may be wrongly escaping quotes)
fix #7859 (comment)
fix #5611
fix #7267