Closed Bug 791574 Opened 7 years ago Closed 7 years ago

Use a Unix-compatible list2cmdline in jstests.py

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: sfink, Assigned: sfink)

Details

(Whiteboard: [mozbase])

Attachments

(1 file)

Sadly, subprocess.list2cmdline only seems to do something sensible for Windows, which I find rather bizarre.
This patch fixes the problem where -s can give you something like

  ./js -e option(\'allow_xml\'); -f ...

which is totally invalid in bash.
Attachment #661628 - Flags: review?(terrence)
Comment on attachment 661628 [details] [diff] [review]
Use a Unix-compatible list2cmdline

Review of attachment 661628 [details] [diff] [review]:
-----------------------------------------------------------------

That is indeed totally bizarre.

::: js/src/tests/lib/results.py
@@ +5,5 @@
> +if (sys.platform.startswith('linux') or
> +    sys.platform.startswith('darwin')
> +   ):
> +    import pipes
> +    list2cmdline = lambda args: ' '.join([ pipes.quote(a) for a in args ])

Neat trick!  I had no idea pipes even existed.  If quote works correct on Windows as well, just use this variant unconditionally.
Attachment #661628 - Flags: review?(terrence) → review+
(In reply to Terrence Cole [:terrence] from comment #2)
> Neat trick!  I had no idea pipes even existed.

Me neither, but Our Benevolent Overlord Google does.

> If quote works correct on Windows as well, just use this variant unconditionally.

That's a good point. It seems to, since MozillaBuild gives you a bash shell anyway. I didn't have a working shell on Windows, but it generally seemed to work, so I'll do that. Thanks. It can't be any worse than what it does now.
https://hg.mozilla.org/mozilla-central/rev/ea2e059c896b
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
we may want to put this in e.g. mozfile at this point
Whiteboard: [mozbase]
You need to log in before you can comment on or make changes to this bug.