From a572fb7b8f00e39723cd98d6936f63171b26c8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Fri, 28 Apr 2023 16:10:10 +0200 Subject: [PATCH] fix: quote paths given to singularity in order to ensure that it does not fail when paths contain whitespace (#2190) ### Description ### QC * [x] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [x] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake). --- snakemake/deployment/singularity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snakemake/deployment/singularity.py b/snakemake/deployment/singularity.py index 71c692907..5f3c2691a 100644 --- a/snakemake/deployment/singularity.py +++ b/snakemake/deployment/singularity.py @@ -117,15 +117,15 @@ def shellcmd( if is_python_script: # mount host snakemake module into container - args += " --bind {}:{}".format(SNAKEMAKE_SEARCHPATH, SNAKEMAKE_MOUNTPOINT) + args += f" --bind {repr(SNAKEMAKE_SEARCHPATH)}:{repr(SNAKEMAKE_MOUNTPOINT)}" if container_workdir: - args += " --pwd {}".format(container_workdir) + args += f" --pwd {repr(container_workdir)}" cmd = "{} singularity {} exec --home {} {} {} {} -c '{}'".format( envvars, "--quiet --silent" if quiet else "", - os.getcwd(), + repr(os.getcwd()), args, img_path, shell_executable,