[Lldb-commits] [lldb] r328020 - [lldb-dotest] Wrap arguments in single quotes
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 21 03:01:54 PDT 2018
Instead of trying to guess how the shell will interpret your command line,
it would be better to just use a primitive which bypasses the shell
altogether. For example you can use subprocess.call(), and just forward it
the list of arguments verbatim.
You'd need to do some special processing on the args you got from cmake, as
these are already a string, but this could be handled by forwarding them as
a list (separated by semicolon) and then just breaking it up around
semicolons. This will still not be perfect forwarding, but it will already
be a big improvement over how it's handled right now.
On Tue, 20 Mar 2018 at 19:20, Jonas Devlieghere via lldb-commits <
lldb-commits at lists.llvm.org> wrote:
> Author: jdevlieghere
> Date: Tue Mar 20 12:18:11 2018
> New Revision: 328020
>
> URL: http://llvm.org/viewvc/llvm-project?rev=328020&view=rev
> Log:
> [lldb-dotest] Wrap arguments in single quotes
>
> If we don't wrap arguments to the wrapper in single quotes, combined
> arguments, for example for -E, don't reach dotest.py as a unit but as
> separate arguments, causing the latter to fail.
>
> Modified:
> lldb/trunk/test/lldb-dotest.in
>
> Modified: lldb/trunk/test/lldb-dotest.in
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb-dotest.in?rev=328020&r1=328019&r2=328020&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/lldb-dotest.in (original)
> +++ lldb/trunk/test/lldb-dotest.in Tue Mar 20 12:18:11 2018
> @@ -6,9 +6,13 @@ dotest_path = '@LLDB_SOURCE_DIR@/test/do
> dotest_args = '@LLDB_DOTEST_ARGS_STR@'
>
> if __name__ == '__main__':
> + # Wrap arguments in single quotes. This is necessary because we want
> to
> + # forward the arguments and otherwise we might split up arguments
> that were
> + # originally wrapped in single quotes.
> + wrapper_args = list("'" + i + "'" for i in sys.argv[1:])
> # FIXME: It would be nice if we can mimic the approach taken by
> llvm-lit
> # and pass a python configuration straight to dotest, rather than
> going
> # through the operating system.
> - command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
> - sys.argv[1:]))
> + command = '{} -q {} {}'.format(dotest_path, dotest_args,
> + ' '.join(wrapper_args))
> os.system(command)
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180321/fd6a7c1b/attachment-0001.html>
More information about the lldb-commits
mailing list