From c6598eb20107f11dad6d58bc122a8cc5f3b954db Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Sat, 30 Jun 2018 23:33:27 -0400 Subject: [PATCH 1/3] Detect pathmapper name conflicts. --- cwltool/pathmapper.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cwltool/pathmapper.py b/cwltool/pathmapper.py index a2154abf8..13f5b7fa3 100644 --- a/cwltool/pathmapper.py +++ b/cwltool/pathmapper.py @@ -272,6 +272,13 @@ def setup(self, referenced_files, basedir): stagedir = os.path.join(self.stagedir, "stg%s" % uuid.uuid4()) self.visit(fob, stagedir, basedir, copy=fob.get("writable"), staged=True) + targets = {} + for k,v in self._pathmap.items(): + if v.target in targets: + raise validate.ValidationException("Name conflict: both %s and %s have been assigned to target %s" % (k, targets[v.target], v.target)) + if v.type != "Directory": + targets[v.target] = k + def mapper(self, src): # type: (Text) -> MapperEnt if u"#" in src: i = src.index(u"#") From e272a2802bda06ca35a992311b5b84fa2555e057 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Sat, 30 Jun 2018 23:57:32 -0400 Subject: [PATCH 2/3] Fix type annotation --- cwltool/pathmapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwltool/pathmapper.py b/cwltool/pathmapper.py index 13f5b7fa3..498984f96 100644 --- a/cwltool/pathmapper.py +++ b/cwltool/pathmapper.py @@ -272,7 +272,7 @@ def setup(self, referenced_files, basedir): stagedir = os.path.join(self.stagedir, "stg%s" % uuid.uuid4()) self.visit(fob, stagedir, basedir, copy=fob.get("writable"), staged=True) - targets = {} + targets = {} # type: Dict[Text, Text] for k,v in self._pathmap.items(): if v.target in targets: raise validate.ValidationException("Name conflict: both %s and %s have been assigned to target %s" % (k, targets[v.target], v.target)) From 476952d11781f1f221ad40dac9c0eda27acb3496 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 5 Sep 2021 15:49:27 +0200 Subject: [PATCH 3/3] fix formatting --- cwltool/pathmapper.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cwltool/pathmapper.py b/cwltool/pathmapper.py index 3c73df696..7ed4437e6 100644 --- a/cwltool/pathmapper.py +++ b/cwltool/pathmapper.py @@ -177,11 +177,14 @@ def setup(self, referenced_files: List[CWLObjectType], basedir: str) -> None: copy=cast(bool, fob.get("writable", False)), staged=True, ) - - targets = {} # type: Dict[Text, Text] - for k,v in self._pathmap.items(): + + targets: Dict[str, str] = {} + for k, v in self._pathmap.items(): if v.target in targets: - raise validate.ValidationException("Name conflict: both %s and %s have been assigned to target %s" % (k, targets[v.target], v.target)) + raise ValidationException( + "Name conflict: both %s and %s have been assigned to target %s" + % (k, targets[v.target], v.target) + ) if v.type != "Directory": targets[v.target] = k