[PATCH] D99406: RFC [lit] Detect if processes to execute are MSys based, apply custom quoting logic

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 03:15:24 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
Herald added a subscriber: delcypher.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

There's no single quoting strategy that works for all kinds of inputs
in a consistent way to both regular win32 executables and MSys based
ones. Instead try to detect the target executable kind, and apply the
most appropriate quoting logic.

This is a different alternative to D99330 <https://reviews.llvm.org/D99330>. This requires an extra
python module (from https://github.com/erocarrera/pefile) - I presume
we can't just blindly add such new dependencies, not even if made
conditional to when running on windows. We could bundle it in-tree
though (if that's acceptable license-wise).

I'm not sure if this is the way to go or not, but this contains
examples of what breaks and disqualifies other solution attempts,
and showcases the issue that D99330 <https://reviews.llvm.org/D99330> works around.

The added testcases fail if executed with msys (e.g. git bash) based
tools today, before fixing the quoting.

With D98859 <https://reviews.llvm.org/D98859> applied, one can also run the same testcase wrapped in 'not',
with 'not not echo' - with this fix alone the plain 'echo' cases work,
but not when roundtripped via the 'not' tool (which uses
llvm/lib/Support/Windows/Program.inc for quoting arguments, which
uses quoting logic of its own).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99406

Files:
  llvm/test/Other/lit-quoting.txt
  llvm/utils/lit/lit/TestRunner.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99406.333522.patch
Type: text/x-patch
Size: 5191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210326/fdfc3599/attachment-0001.bin>


More information about the llvm-commits mailing list