Skip to content

RFE: check for environment variables' existence in fstab #237

@kcgthb

Description

@kcgthb

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions