From d1cf0def31b9060f5fe4b4f116ae8a8f47d0633e Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 9 Jan 2017 15:11:34 -0500 Subject: [PATCH] Do not allow recursive replacements in PJA. May result in infinite loops in workflow scheduling threads. --- lib/galaxy/jobs/actions/post.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/jobs/actions/post.py b/lib/galaxy/jobs/actions/post.py index dfab700ba66..d0e3dee7266 100644 --- a/lib/galaxy/jobs/actions/post.py +++ b/lib/galaxy/jobs/actions/post.py @@ -111,11 +111,12 @@ class RenameDatasetAction(DefaultJobAction): # "replace" option so you can replace a portion of the name, # support multiple #{name} in one rename action... - while new_name.find("#{") > -1: + start_pos = 0 + while new_name.find("#{", start_pos) > -1: to_be_replaced = "" # This assumes a single instance of #{variable} will exist - start_pos = new_name.find("#{") + 2 - end_pos = new_name.find("}") + start_pos = new_name.find("#{", start_pos) + 2 + end_pos = new_name.find("}", start_pos) to_be_replaced = new_name[start_pos:end_pos] input_file_var = to_be_replaced # Pull out the piped controls and store them for later