ehough / docker-nfs-server

A lightweight, robust, flexible, and containerized NFS server.
https://hub.docker.com/r/erichough/nfs-server/
GNU General Public License v3.0
669 stars 221 forks source link

Single quotes not removed from export environment variables #52

Closed shayaantx closed 3 years ago

shayaantx commented 4 years ago

Hi,

I had a docker compose block below and the first single quote was preventing the directory from being read which resulted in "WARNING: skipping NFS_EXPORT_0 environment variable since '/downloads is not a container directory"

    environment:
      - NFS_EXPORT_0='/downloads *(ro,all_squash)'

The culprit code is below:

https://github.com/ehough/docker-nfs-server/blob/f97055c848d80fd97b688109255e6d9b95b77355/entrypoint.sh#L458 https://github.com/ehough/docker-nfs-server/blob/f97055c848d80fd97b688109255e6d9b95b77355/entrypoint.sh#L460

We can strip the single quotes easily (see below), lemme know, and I can put up a PR if you want. Might want to consider also stripping double quotes. Or we could make the change against the $line variable before we try to read it into an array.

local dir="${line_as_array[0]//\'/}"

Or lemme know if I'm missing something obvious here.

Thanks

shayaantx commented 4 years ago

Actually the same single quote stripping would need to happen in the below code too, so probably best to strip single/double quotes right after reading the environment variable

https://github.com/ehough/docker-nfs-server/blob/f97055c848d80fd97b688109255e6d9b95b77355/entrypoint.sh#L481

shayaantx commented 3 years ago

nvm I should be wrapping the entire environment variable (including the key in single or double quotes)