Closed rdxmb closed 1 year ago
Hi @rdxmb
Variable values with strings with more than one word, like a cron expression, must be quoted to be evaluated as a single value, this is a bash restriction.
Hi @juanluisbaptiste ,
yes of course.
Oh! I have just seen that I forgot the quoting in the description :see_no_evil:
I have just changed that and commented so you should see the problem now.
Regards!
Another demonstration:
$ export OTRS_BACKUP_TIME='20 20 * * *'
$ printenv | sed 's/^\(.*\)$/export \1/g' | grep -E "^export OTRS_" | tee /tmp/.backup.env
export OTRS_BACKUP_TIME=20 20 * * *
When sourcing this .backup.env
, the *
are expanded, of course.
$ source /tmp/.backup.env
bash: export: `20': not a valid identifier
bash: export: `backup.env': not a valid identifier
bash: export: `exthost-0721e8.cpuprofile': not a valid identifier
bash: export: `exthost-098f2e.cpuprofile': not a valid identifier
bash: export: `exthost-0f7391.cpuprofile': not a valid identifier
# --------- snip
@juanluisbaptiste could this be reopened, please?
Reporting a bug
The container-env-variables written to
/.backup.env
are not quoted, and so they have unexpected values.Image and OTRS versions
juanluisbaptiste/otrs:6.0.37
Describe the issue
When sourcing the
/.backup.env
like it is done in the backup-cronjob, the values of the variables are set without spaces and - in case of variables with*
(cron-statement), expanded.Expected behavior
Variables are quoted.
Reproduce
set a container-env-variable like
start the container and checkout
Link to code
https://github.com/juanluisbaptiste/docker-otrs/blob/master/otrs/functions.sh#L592
Edited: fix the quotes to show the problem