cifs_k8s_plugin icon indicating copy to clipboard operation
cifs_k8s_plugin copied to clipboard

Fix issues with argument escaping in cifs.sh

Open jperville opened this issue 9 years ago • 0 comments

This PR fixes issue with shell argument escaping.

When the CIFS source argument contains a space, the mount fails. And it will probably fail if any of the other arguments contains a space (for example the fsType).

The reason is that when invoking is invoked with cifs.sh the mount action, $3 which contains the json options is broken into $3 and $4 in the switch that runs the domount() function. As a result, the JQ parsing of $3 fails silently ($3 is invalid JSON document since the missing part is in $4), then the mount ultimately fails.

How to reproduce:

./cifs.sh \
  mount \
  /mnt \
  /dev/null \
 '{"kubernetes.io/fsType":"","mountOptions":"","source":"//192.168.56.101/shared space"}'

jperville avatar Mar 03 '17 16:03 jperville