-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Hi!
The Image Format allows using environment variables from the host in the fstab specification:
References to environment variables from the host of the form ${ENVVAR} will be substituted.
This is great, but it could lead to errors when those environment variables are not defined. Typically, like this:
$ enroot start image echo ok
enroot-mount: failed to mount: none at /tmp/.enroot/data/image/none: No such file or directory
This is because when $VAR is undefined, a fstab like
${VAR} ${VAR} none x-create=dir,bind,rw,nosuid
will result in just none x-create=dir,bind,rw,nosuid being passed to enroot-mount.
The parsing of those environment variables is done via awk in common::envsubst() (common.sh), so usual bash substitution can't be used there (like for instance ${VAR:-#}).
Since it's not really possible to make the .fstab files in mounts.d/* conditional or select/disable them at run time, would it be possible to add a test to prevent undefined environment variables in .fstab files from generating mounting errors?
Thanks!