Patchwork [2,of,2] test-check-code: do not use xargs

login
register
mail settings
Submitter Jun Wu
Date April 7, 2017, 5:13 a.m.
Message ID <86847271e19bf2bb87d3.1491541982@x1c>
Download mbox | patch
Permalink /patch/19992/
State Accepted
Headers show

Comments

Jun Wu - April 7, 2017, 5:13 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1491541846 25200
#      Thu Apr 06 22:10:46 2017 -0700
# Node ID 86847271e19bf2bb87d36db7d0418f1b5e52a4b3
# Parent  9a84025f33b33ba68a7c0bac763f9c756e1f81d0
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 86847271e19b
test-check-code: do not use xargs

We have too many files, and passing them via arguments could cause strange
errors on some platforms [1]. Since check-code.py can now take "-" and read
file names from stdin, use it instead of xargs to avoid the argv size limit.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/096346.html
Ryan McElroy - April 7, 2017, 8:27 a.m.
On 4/7/17 6:13 AM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1491541846 25200
> #      Thu Apr 06 22:10:46 2017 -0700
> # Node ID 86847271e19bf2bb87d36db7d0418f1b5e52a4b3
> # Parent  9a84025f33b33ba68a7c0bac763f9c756e1f81d0
> test-check-code: do not use xargs

This series looks good to me. Marked as pre-reviewed in patchwork.

>
> We have too many files, and passing them via arguments could cause strange
> errors on some platforms [1]. Since check-code.py can now take "-" and read
> file names from stdin, use it instead of xargs to avoid the argv size limit.

Isn't xargs supposed to be aware of the argv limit and split up calls 
appropriately? Seems like a bug on MinGW's xargs if it's not working there.

Regardless, the fix seems good.

>
> [1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/096346.html
>
> diff --git a/tests/test-check-code.t b/tests/test-check-code.t
> --- a/tests/test-check-code.t
> +++ b/tests/test-check-code.t
> @@ -9,5 +9,5 @@ New errors are not allowed. Warnings are
>   
>     $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
> -  > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false
> +  > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
>     contrib/perf.py:859:
>      >             r.revision(r.node(x))
>
Yuya Nishihara - April 7, 2017, 11:59 a.m.
On Fri, 7 Apr 2017 09:27:49 +0100, Ryan McElroy wrote:
> On 4/7/17 6:13 AM, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark@fb.com>
> > # Date 1491541846 25200
> > #      Thu Apr 06 22:10:46 2017 -0700
> > # Node ID 86847271e19bf2bb87d36db7d0418f1b5e52a4b3
> > # Parent  9a84025f33b33ba68a7c0bac763f9c756e1f81d0
> > test-check-code: do not use xargs
> 
> This series looks good to me. Marked as pre-reviewed in patchwork.

Queued, thanks.

Patch

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -9,5 +9,5 @@  New errors are not allowed. Warnings are
 
   $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
-  > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false
+  > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
   contrib/perf.py:859:
    >             r.revision(r.node(x))