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

public shell_quote, shell_unquote API #33024

Closed
StefanKarpinski opened this issue Aug 22, 2019 · 1 comment
Closed

public shell_quote, shell_unquote API #33024

StefanKarpinski opened this issue Aug 22, 2019 · 1 comment

Comments

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Aug 22, 2019

There's a reason that Base.shell_escape, Base.shell_parse and Base.shell_split are not exported: they are kind of a wonky, not-quite right API, with bad names. I've highlighted some of the issues in #31989 (comment), including:

  • Base.shell_escape does quoting not escaping
  • Base.shell_parse should be pared with Base.shell_quote but it produces a very internal data structure that is not really useful outside of the implementation of backticks
  • Base.shell_split is actually the rough inverse of Base.shell_escape but not quite: Base.shell_escape is String --> String while Base.shell_split is String --> Vector{String}
  • There are also the variations: Base.shell_escape_posixly and hypothetically Base.shell_escape_dosly and Base.shell_escape_powerfully (for PowerShell, presumably, @vtjnash?)

It would be good to have an official shell quoting and unquoting API since as it is people are just using Base.shell_escape even though it's internal and unofficial. Maybe it belongs in a packages (or stdlib) but the current situation is a bit of a mess (my mess).

@JamesWrigley
Copy link
Contributor

I seem to have inadvertently done this anyway in #53510 😅 I guess this can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants