Skip to content

Commit cf18555

Browse files
authored
Check for $( or ${ in string to eval before calling interpolate. (#548)
* Check for $( or ${ in string to eval before calling interpolate. * Improve error logged in collect_output_ports.
1 parent dd13278 commit cf18555

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

cwltool/draft2tool.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -519,19 +519,14 @@ def collect_output_ports(self, ports, builder, outdir, compute_checksum=True, jo
519519
_logger.debug(u"Raw output from %s: %s", custom_output, json.dumps(ret, indent=4))
520520
else:
521521
for i, port in enumerate(ports):
522-
with SourceLine(ports, i, WorkflowException, debug):
523-
fragment = shortname(port["id"])
524-
try:
525-
ret[fragment] = self.collect_output(port, builder, outdir, fs_access,
526-
compute_checksum=compute_checksum)
527-
except Exception as e:
528-
_logger.debug(
529-
u"Error collecting output for parameter '%s'"
530-
% shortname(port["id"]), exc_info=True)
531-
raise WorkflowException(
522+
def makeWorkflowException(msg):
523+
return WorkflowException(
532524
u"Error collecting output for parameter '%s':\n%s"
533-
% (shortname(port["id"]), indent(u(str(e)))))
534-
525+
% (shortname(port["id"]), msg))
526+
with SourceLine(ports, i, makeWorkflowException, debug):
527+
fragment = shortname(port["id"])
528+
ret[fragment] = self.collect_output(port, builder, outdir, fs_access,
529+
compute_checksum=compute_checksum)
535530
if ret:
536531
revmap = partial(revmap_file, builder, outdir)
537532
adjustDirObjs(ret, trim_listing)

cwltool/expression.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def do_eval(ex, jobinput, requirements, outdir, tmpdir, resources,
214214
u"self": context,
215215
u"runtime": runtime}
216216

217-
if isinstance(ex, (str, Text)):
217+
if isinstance(ex, (str, Text)) and ("$(" in ex or "${" in ex):
218218
fullJS = False
219219
jslib = u""
220220
for r in reversed(requirements):

0 commit comments

Comments
 (0)