<div><div dir="auto">Hi Greg,</div></div><div dir="auto"><br></div><div dir="auto">Paths with spaces will work because we split from the right and at most once. So unless you provide an invalid syntax to the function (which we control</div><div dir="auto">through the test) it should work fine.</div><div dir="auto"><br></div><div dir="auto">I’m not saying that my hand rolled thingy replaces shlex in general, but it should do the right thing for this simple test. </div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Jonas</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2019 at 23:18 Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So if there is a space in the path this will fail? shlex does really complex stuff like turn:<br>
<br>
"hello"' world' <br>
<br>
into one "hello world" argument. If this is just for one controlled test whose arguments are guaranteed to no ever have any quotes or desensitized spaces like:<br>
<br>
hello\ world<br>
<br>
Then it is ok, but not ok to just call the small new "split" function you added a replacement for shlex?<br>
<br>
Greg<br>
<br>
> On Apr 11, 2019, at 12:36 PM, Jonas Devlieghere via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
> <br>
> Author: jdevlieghere<br>
> Date: Thu Apr 11 12:36:53 2019<br>
> New Revision: 358216<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=358216&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=358216&view=rev</a><br>
> Log:<br>
> [test] Fix & re-enable CommandScriptImmediateOutputFile on Windows<br>
> <br>
> Apparently the shlex module produces garbage on Windows. I've added a<br>
> hand rolled split instead that should suffice for this test.<br>
> <br>
> Modified:<br>
>    lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test<br>
>    lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py<br>
> <br>
> Modified: lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test?rev=358216&r1=358215&r2=358216&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test?rev=358216&r1=358215&r2=358216&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test (original)<br>
> +++ lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test Thu Apr 11 12:36:53 2019<br>
> @@ -1,5 +1,3 @@<br>
> -# UNSUPPORTED: system-windows<br>
> -<br>
> # Test that LLDB correctly allows scripted commands to set immediate output to<br>
> # a file.<br>
> <br>
> <br>
> Modified: lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py?rev=358216&r1=358215&r2=358216&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py?rev=358216&r1=358215&r2=358216&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py (original)<br>
> +++ lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py Thu Apr 11 12:36:53 2019<br>
> @@ -1,16 +1,19 @@<br>
> from __future__ import print_function<br>
> <br>
> import sys<br>
> -import shlex<br>
> <br>
> <br>
> +def split(command):<br>
> +    command = command.strip()<br>
> +    return command.rsplit(' ', 1)<br>
> +<br>
> def command_function(debugger, command, exe_ctx, result, internal_dict):<br>
>     result.SetImmediateOutputFile(sys.__stdout__)<br>
>     print('this is a test string, just a test string', file=result)<br>
> <br>
> <br>
> def write_file(debugger, command, exe_ctx, result, internal_dict):<br>
> -    args = shlex.split(command)<br>
> +    args = split(command)<br>
>     path = args[0]<br>
>     mode = args[1]<br>
>     with open(path, mode) as f:<br>
> <br>
> <br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone</div>