Skip to content

Path escaping for rebar shell command in deps.compile.ex #13750

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

Closed
gdyr opened this issue Jul 31, 2024 · 3 comments · Fixed by #13751
Closed

Path escaping for rebar shell command in deps.compile.ex #13750

gdyr opened this issue Jul 31, 2024 · 3 comments · Fixed by #13751

Comments

@gdyr
Copy link
Contributor

gdyr commented Jul 31, 2024

cmd = "#{rebar_cmd(dep)} bare compile --paths #{escape_path(lib_path)}"

Compilation of Phoenix dependency "telemetry" using Rebar fails when parentheses (or presumably other shell-significant characters) appear in the project path.

This is due to inadequate escaping in escape_path()...

String.replace(path, " ", escape)

... but could be avoided by using System.cmd()/3 instead of Mix.shell().cmd(), to pass arguments without needing to escape them.

I've attempted a fix in 806a889, but this breaks the case where there is a space in the path to rebar - if I get more time, I'll continue investigating, but perhaps someone else may want to pick this up in the meantime?

@josevalim
Copy link
Member

@gdyr can you please send a PR with your changes so far? I don't see why a space on the path to rebar would be a problem.

@josevalim
Copy link
Member

@josevalim
Copy link
Member

Closing in favor of the PR: #13751 Thanks!

josevalim added a commit that referenced this issue Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants