[libcxx-commits] [libcxx] [libcxx] [test] Quote the python executable in the executor (PR #68208)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 5 14:07:42 PDT 2023
================
@@ -320,7 +325,7 @@ def getStdFlag(cfg, std):
Parameter(
name="executor",
type=str,
- default=f"\"{sys.executable}\" {Path(__file__).resolve().parent.parent.parent / 'run.py'}",
+ default=f"{quote(sys.executable)} {quote(str(Path(__file__).resolve().parent.parent.parent / 'run.py'))}",
----------------
mstorsjo wrote:
Oh, good catch. I saw some discussions about whether this function should be made public (as they can't practically change it anyway, since lots of people seem to use it) - but for now I guess it'd be best to not use it.
If we're not using that one, I'm on the fence about whether we should go for `shlex.quote()`, always wrapping double quotes (like we did in cmake before), or maybe a custom function that wraps quotes around it if there are spaces in the string. `shlex.quote()` isn't generally a great fit, as it is documented to not be cross platform - it specifically does quoting for unix paths/shells. For Windows paths, it always quotes them as they contain backslashes. (Always quoting them isn't an issue in itself per se, though. And the fact that `shlex.quote()` uses single quotes instead of double quotes, is ok as long as we're using the lit internal shell instead of an actual Windows shell.)
https://github.com/llvm/llvm-project/pull/68208
More information about the libcxx-commits
mailing list