common-workflow-language / common-workflow-language/cwltool
`--tmpdir-prefix` argument not checked for trailing delimiter
- Dominant language
- Python
- Stars
- 376
- Forks
- 255
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 12
Description
```
$ cwltool --version
/vol/mgx-sw/bin/cwltool 3.1.20230425144158
```
When invoked with `--tmpdir-prefix /vol/sge-tmp` (a directory), cwltool doesn't add a trailing slash, and workflow
execution fails:
```
ERROR Unexpected exception
Traceback (most recent call last):
File "/vol/mgx-sw/lib/venvs/cwltool/lib/python3.11/site-packages/cwltool/workflow.py", line 459, in job
yield from self.embedded_tool.job(
File "/vol/mgx-sw/lib/venvs/cwltool/lib/python3.11/site-packages/cwltool/command_line_tool.py", line 960, in job
builder = self._init_job(job_order, runtimeContext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vol/mgx-sw/lib/venvs/cwltool/lib/python3.11/site-packages/cwltool/process.py", line 857, in _init_job
tmpdir = fs_access.realpath(runtime_context.get_tmpdir())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vol/mgx-sw/lib/venvs/cwltool/lib/python3.11/site-packages/cwltool/context.py", line 215, in get_tmpdir
return self.create_tmpdir()
^^^^^^^^^^^^^^^^^^^^
File "/vol/mgx-sw/lib/venvs/cwltool/lib/python3.11/site-packages/cwltool/context.py", line 227, in create_tmpdir
return tempfile.mkdtemp(prefix=tmp_prefix, dir=tmp_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/vol/mgx-sw/lib/python3.11/tempfile.py", line 368, in mkdtemp
_os.mkdir(file, 0o700)
PermissionError: [Errno 13] Permission denied: '/vol/sge-tmpv4nl9n8x'
ERROR Cannot make scatter job: [Errno 13] Permission denied: '/vol/sge-tmpv4nl9n8x'
```
I just discussed this with @mr-c, and he suggested to provide a better error message to `create_tmpdir()` in `cwltool.context`,
i.e. suggesting to either adding a trailing slash to the argument or to check for write permissions.
Contributor guide
Assessment
This issue has not been assessed yet.