Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote conda prefix in install command #13070

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/deps/conda_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def install_conda(conda_context, force_conda_build=False):
with tempfile.NamedTemporaryFile(suffix=".sh", prefix="conda_install", delete=False) as temp:
script_path = temp.name
download_cmd = commands.download_command(conda_link(), to=script_path)
install_cmd = ['bash', script_path, '-b', '-p', conda_context.conda_prefix]
install_cmd = ['bash', script_path, '-b', '-p', shlex.quote(conda_context.conda_prefix)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite sure this is not necessary, and actually breaks it if conda_context.conda_prefix contains a space. E.g.:

In [1]: import shlex                                                                                                                                                                                       

In [2]: from galaxy.util.commands import shell                                                                                                                                                             

In [3]: shell(["ls", "/tmp/galaxy root"])                                                                                                                                                                  
foo
Out[3]: 0

In [4]: shell(["ls", shlex.quote("/tmp/galaxy root")])                                                                                                                                                     
ls: cannot access "'/tmp/galaxy root'": No such file or directory
Out[4]: 2

package_targets = [
f"conda={CONDA_VERSION}",
]
Expand Down