CSCfi / hpc-container-wrapper

Tool to wrap installations into a container designed for use on HPC systems
MIT License
27 stars 8 forks source link

Directories with spaces break things #24

Open akx opened 3 months ago

akx commented 3 months ago

There's a distinct lack of argument quoting in the shell scripts, so arguments with spaces or e.g. globbing characters like ? or * break things. Of course, users probably shouldn't use spaces in these arguments, but the programs also preferably shouldn't break...

Repro:

$ mkdir "foo bar"
$ cd "foo bar"
$ echo tqdm > requirements.txt
$ mkdir "bar foo"
$ pip-containerize new --slim --prefix "bar foo" requirements.txt
[ INFO ] Constructing configuration
[ INFO ] Using /tmp/cw-XBIMVU as temporary directory
stat: cannot statx './bar': No such file or directory
stat: cannot statx 'foo/': No such file or directory
chgrp: missing operand after ‘/tmp/cw-XBIMVU’
Try 'chgrp --help' for more information.
[ ERROR ] Set CW_DEBUG_KEEP_FILES env variable to keep build files
Terminated
$
Nortamo commented 3 months ago

Very valid point, but probably a wontfix at least for now due to a lack of time. Due to the poor craftsmanship of the original code :sweat_smile: , there are a bunch of construct like var=($( which cant be fixed automatically and needs manual intervention. But I'll leave this open for now in case I get around to it.

akx commented 3 months ago

No worries. For my experiment, I ended up using https://github.com/DeiC-HPC/cotainr/ instead anyway (and contributing a couple of PRs that way too...).