common-workflow-language / common-workflow-language/cwltool

cwltool mishandles line continuations in bash scripts

Open
#1,271 4 comments 0 reactions 1 assignee Assigned to @tetron View on GitHub
bug
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

```
cwltool --version
/Users/kghose/.venvs/toil/bin/cwltool 3.0.20200324120055
```

The following bash script is valid

```
set -xv

echo \
"A new line" \
"Another line" \
"Boo"
```

The following CWL with an embedded bash script is not correctly handled by `cwltool`. It looks like the line continuation `\` symbol is removed?

```
class: CommandLineTool
cwlVersion: v1.0
requirements:
DockerRequirement:
dockerPull: sevenbridges/svsim:1.0
InitialWorkDirRequirement:
listing:
- entryname: script.sh
entry: |
set -xv

echo \
"A new line" \
"Another line" \
"$(inputs.foo)"

baseCommand: ["bash", "script.sh"]

inputs:
foo: string

outputs:
out: stdout

stdout: out.txt
```

The cwltool (and also toil, since toil uses cwltool) error is:
```
echo
+ echo
"A new line"
+ 'A new line'
script.sh: line 4: A new line: command not found
"Another line"
+ 'Another line'
script.sh: line 5: Another line: command not found
"Hello"
+ Hello
script.sh: line 6: Hello: command not found
INFO [job test.cwl] Max memory used: 0MiB
WARNING [job test.cwl] completed permanentFail
```

As a contrast the SB platform executor executes this correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.