Patchwork [2,of,2] tests: add new test for #! shbang lines

login
register
mail settings
Submitter timeless@mozdev.org
Date April 7, 2016, 1:26 a.m.
Message ID <16e6523533e263430f06.1459992397@waste.org>
Download mbox | patch
Permalink /patch/14409/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

timeless@mozdev.org - April 7, 2016, 1:26 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1459969752 0
#      Wed Apr 06 19:09:12 2016 +0000
# Node ID 16e6523533e263430f06ffd785c921a114268199
# Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
tests: add new test for #! shbang lines

* use #!/bin/sh not e.g. #!/usr/bin/sh
* use #!/usr/bin/env python not e.g. #!/usr/bin/python
Yuya Nishihara - April 8, 2016, 2:34 p.m.
On Wed, 06 Apr 2016 20:26:37 -0500, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1459969752 0
> #      Wed Apr 06 19:09:12 2016 +0000
> # Node ID 16e6523533e263430f06ffd785c921a114268199
> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
> tests: add new test for #! shbang lines
                             ^^^^^^
                             perhaps sh"e"bang is more common

> * use #!/bin/sh not e.g. #!/usr/bin/sh
> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
> 
> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
> copy from tests/test-check-execute.t
> copy to tests/test-check-shbang.t
> --- a/tests/test-check-execute.t
> +++ b/tests/test-check-shbang.t
> @@ -1,23 +1,13 @@
> -#require test-repo execbit
> +#require test-repo
>  
>    $ cd "`dirname "$TESTDIR"`"
>  
> -look for python scripts without the execute bit
> +look for python scripts that do not use /usr/bin/env
>  
> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env python")'
>    [1]
>  
> -look for python scripts with execute bit but not shebang
> +look for shell scripts that do not use /bin/sh
>  
> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>    [1]

My two cents, should we integrate this into check-code.py?
Pierre-Yves David - April 13, 2016, 6:58 a.m.
On 04/08/2016 07:34 AM, Yuya Nishihara wrote:
> On Wed, 06 Apr 2016 20:26:37 -0500, timeless wrote:
>> # HG changeset patch
>> # User timeless <timeless@mozdev.org>
>> # Date 1459969752 0
>> #      Wed Apr 06 19:09:12 2016 +0000
>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>> tests: add new test for #! shbang lines
>                               ^^^^^^
>                               perhaps sh"e"bang is more common

I agree with yuyua here, I've changed this to shebang.

>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>
>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>> copy from tests/test-check-execute.t
>> copy to tests/test-check-shbang.t
>> --- a/tests/test-check-execute.t
>> +++ b/tests/test-check-shbang.t
>> @@ -1,23 +1,13 @@
>> -#require test-repo execbit
>> +#require test-repo
>>   
>>     $ cd "`dirname "$TESTDIR"`"
>>   
>> -look for python scripts without the execute bit
>> +look for python scripts that do not use /usr/bin/env
>>   
>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env python")'
>>     [1]
>>   
>> -look for python scripts with execute bit but not shebang
>> +look for shell scripts that do not use /bin/sh
>>   
>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>     [1]
> My two cents, should we integrate this into check-code.py?

Maybe, but the python shebang are not tested in checkcode either so I 
think it is fine to take this one as is.
Matt Harbison - April 16, 2016, 2:19 a.m.
On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:

> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1459969752 0
> #      Wed Apr 06 19:09:12 2016 +0000
> # Node ID 16e6523533e263430f06ffd785c921a114268199
> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
> tests: add new test for #! shbang lines
>
> * use #!/bin/sh not e.g. #!/usr/bin/sh
> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>
> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
> copy from tests/test-check-execute.t
> copy to tests/test-check-shbang.t
> --- a/tests/test-check-execute.t
> +++ b/tests/test-check-shbang.t
> @@ -1,23 +1,13 @@
> -#require test-repo execbit
> +#require test-repo
>   $ cd "`dirname "$TESTDIR"`"
> -look for python scripts without the execute bit
> +look for python scripts that do not use /usr/bin/env
> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env  
> python")'
>    [1]
> -look for python scripts with execute bit but not shebang
> +look for shell scripts that do not use /bin/sh
> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>    [1]

Is there a way to lose these lines other than `grep -v`?

    $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
+  obsolete feature not enabled but 110079 markers found!
    [1]

(I'm a bit surprised nobody else is seeing this?)
Yuya Nishihara - April 16, 2016, 5:56 a.m.
On Fri, 15 Apr 2016 22:19:51 -0400, Matt Harbison wrote:
> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
> > # HG changeset patch
> > # User timeless <timeless@mozdev.org>
> > # Date 1459969752 0
> > #      Wed Apr 06 19:09:12 2016 +0000
> > # Node ID 16e6523533e263430f06ffd785c921a114268199
> > # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
> > tests: add new test for #! shbang lines
> >
> > * use #!/bin/sh not e.g. #!/usr/bin/sh
> > * use #!/usr/bin/env python not e.g. #!/usr/bin/python
> >
> > diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
> > copy from tests/test-check-execute.t
> > copy to tests/test-check-shbang.t
> > --- a/tests/test-check-execute.t
> > +++ b/tests/test-check-shbang.t
> > @@ -1,23 +1,13 @@
> > -#require test-repo execbit
> > +#require test-repo
> >   $ cd "`dirname "$TESTDIR"`"
> > -look for python scripts without the execute bit
> > +look for python scripts that do not use /usr/bin/env
> > -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
> > +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env  
> > python")'
> >    [1]
> > -look for python scripts with execute bit but not shebang
> > +look for shell scripts that do not use /bin/sh
> > -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
> > +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
> >    [1]  
> 
> Is there a way to lose these lines other than `grep -v`?
> 
>     $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
> +  obsolete feature not enabled but 110079 markers found!
>     [1]

2>/dev/null ?

> (I'm a bit surprised nobody else is seeing this?)

I've never seen it without "run-tests.py -l", and it isn't always displayed
even with "-l".
timeless - April 17, 2016, 3:22 a.m.
I hit them all the time. I've complained but never gotten any
particular help in quieting them. When I suggested 2> /dev/null, I'm
pretty sure someone complained. Also, I had to add them to quite a few
places, which really sucked :(

On Fri, Apr 15, 2016 at 10:19 PM, Matt Harbison <mharbison72@gmail.com> wrote:
> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
>
>> # HG changeset patch
>> # User timeless <timeless@mozdev.org>
>> # Date 1459969752 0
>> #      Wed Apr 06 19:09:12 2016 +0000
>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>> tests: add new test for #! shbang lines
>>
>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>
>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>> copy from tests/test-check-execute.t
>> copy to tests/test-check-shbang.t
>> --- a/tests/test-check-execute.t
>> +++ b/tests/test-check-shbang.t
>> @@ -1,23 +1,13 @@
>> -#require test-repo execbit
>> +#require test-repo
>>   $ cd "`dirname "$TESTDIR"`"
>> -look for python scripts without the execute bit
>> +look for python scripts that do not use /usr/bin/env
>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env
>> python")'
>>    [1]
>> -look for python scripts with execute bit but not shebang
>> +look for shell scripts that do not use /bin/sh
>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>    [1]
>
>
> Is there a way to lose these lines other than `grep -v`?
>
>    $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
> +  obsolete feature not enabled but 110079 markers found!
>    [1]
>
> (I'm a bit surprised nobody else is seeing this?)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Matt Harbison - April 17, 2016, 3:40 a.m.
> On Apr 16, 2016, at 11:22 PM, timeless <timeless@gmail.com> wrote:
> 
> I hit them all the time. I've complained but never gotten any
> particular help in quieting them. When I suggested 2> /dev/null, I'm
> pretty sure someone complained. Also, I had to add them to quite a few
> places, which really sucked :(

I'm not keen on throwing away stderr either.  We could put a (?) on the end, since I don't really care what output is captured- it's the false positive that's annoying.  I just wanted to make sure that there wasn't a real issue before burying it.  (E.g., there something wrong with one of the perf tests where it doesn't seem to set HGRCPATH to empty properly on Windows, so it tries and fails to load keyring from the user hgrc, which shows as a diff.  I want to fix that, not hide it.)


>> On Fri, Apr 15, 2016 at 10:19 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>>> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
>>> 
>>> # HG changeset patch
>>> # User timeless <timeless@mozdev.org>
>>> # Date 1459969752 0
>>> #      Wed Apr 06 19:09:12 2016 +0000
>>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>>> tests: add new test for #! shbang lines
>>> 
>>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>> 
>>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>>> copy from tests/test-check-execute.t
>>> copy to tests/test-check-shbang.t
>>> --- a/tests/test-check-execute.t
>>> +++ b/tests/test-check-shbang.t
>>> @@ -1,23 +1,13 @@
>>> -#require test-repo execbit
>>> +#require test-repo
>>>  $ cd "`dirname "$TESTDIR"`"
>>> -look for python scripts without the execute bit
>>> +look for python scripts that do not use /usr/bin/env
>>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env
>>> python")'
>>>   [1]
>>> -look for python scripts with execute bit but not shebang
>>> +look for shell scripts that do not use /bin/sh
>>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>   [1]
>> 
>> 
>> Is there a way to lose these lines other than `grep -v`?
>> 
>>   $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>> +  obsolete feature not enabled but 110079 markers found!
>>   [1]
>> 
>> (I'm a bit surprised nobody else is seeing this?)
>> 
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
timeless - April 17, 2016, 3:51 a.m.
hrm, ok. well, it'd need to be (?),
if you don't use obsolete markings in your repo, then the output
wouldn't happen.

so 2>&1 + (?) seems reasonable.

It is a bunch of files though (I think at least 3).

It definitely happens on linux too (gcc112 where I do my work).

On Sat, Apr 16, 2016 at 11:40 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>
>> On Apr 16, 2016, at 11:22 PM, timeless <timeless@gmail.com> wrote:
>>
>> I hit them all the time. I've complained but never gotten any
>> particular help in quieting them. When I suggested 2> /dev/null, I'm
>> pretty sure someone complained. Also, I had to add them to quite a few
>> places, which really sucked :(
>
> I'm not keen on throwing away stderr either.  We could put a (?) on the end, since I don't really care what output is captured- it's the false positive that's annoying.  I just wanted to make sure that there wasn't a real issue before burying it.  (E.g., there something wrong with one of the perf tests where it doesn't seem to set HGRCPATH to empty properly on Windows, so it tries and fails to load keyring from the user hgrc, which shows as a diff.  I want to fix that, not hide it.)
>
>
>>> On Fri, Apr 15, 2016 at 10:19 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>>>> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
>>>>
>>>> # HG changeset patch
>>>> # User timeless <timeless@mozdev.org>
>>>> # Date 1459969752 0
>>>> #      Wed Apr 06 19:09:12 2016 +0000
>>>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>>>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>>>> tests: add new test for #! shbang lines
>>>>
>>>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>>>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>>>
>>>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>>>> copy from tests/test-check-execute.t
>>>> copy to tests/test-check-shbang.t
>>>> --- a/tests/test-check-execute.t
>>>> +++ b/tests/test-check-shbang.t
>>>> @@ -1,23 +1,13 @@
>>>> -#require test-repo execbit
>>>> +#require test-repo
>>>>  $ cd "`dirname "$TESTDIR"`"
>>>> -look for python scripts without the execute bit
>>>> +look for python scripts that do not use /usr/bin/env
>>>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>>>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env
>>>> python")'
>>>>   [1]
>>>> -look for python scripts with execute bit but not shebang
>>>> +look for shell scripts that do not use /bin/sh
>>>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>>>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>>   [1]
>>>
>>>
>>> Is there a way to lose these lines other than `grep -v`?
>>>
>>>   $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>> +  obsolete feature not enabled but 110079 markers found!
>>>   [1]
>>>
>>> (I'm a bit surprised nobody else is seeing this?)
>>>
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@mercurial-scm.org
>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Matt Harbison - April 17, 2016, 4:03 a.m.
> On Apr 16, 2016, at 11:51 PM, timeless <timeless@gmail.com> wrote:
> 
> hrm, ok. well, it'd need to be (?),
> if you don't use obsolete markings in your repo, then the output
> wouldn't happen.
> 
> so 2>&1 + (?) seems reasonable.

Since the tests also capture stderr, is the redirect even necessary?

> 
> It is a bunch of files though (I think at least 3).
> 
> It definitely happens on linux too (gcc112 where I do my work).
> 
>> On Sat, Apr 16, 2016 at 11:40 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>> 
>>> On Apr 16, 2016, at 11:22 PM, timeless <timeless@gmail.com> wrote:
>>> 
>>> I hit them all the time. I've complained but never gotten any
>>> particular help in quieting them. When I suggested 2> /dev/null, I'm
>>> pretty sure someone complained. Also, I had to add them to quite a few
>>> places, which really sucked :(
>> 
>> I'm not keen on throwing away stderr either.  We could put a (?) on the end, since I don't really care what output is captured- it's the false positive that's annoying.  I just wanted to make sure that there wasn't a real issue before burying it.  (E.g., there something wrong with one of the perf tests where it doesn't seem to set HGRCPATH to empty properly on Windows, so it tries and fails to load keyring from the user hgrc, which shows as a diff.  I want to fix that, not hide it.)
>> 
>> 
>>>>> On Fri, Apr 15, 2016 at 10:19 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>>>>> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
>>>>> 
>>>>> # HG changeset patch
>>>>> # User timeless <timeless@mozdev.org>
>>>>> # Date 1459969752 0
>>>>> #      Wed Apr 06 19:09:12 2016 +0000
>>>>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>>>>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>>>>> tests: add new test for #! shbang lines
>>>>> 
>>>>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>>>>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>>>> 
>>>>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>>>>> copy from tests/test-check-execute.t
>>>>> copy to tests/test-check-shbang.t
>>>>> --- a/tests/test-check-execute.t
>>>>> +++ b/tests/test-check-shbang.t
>>>>> @@ -1,23 +1,13 @@
>>>>> -#require test-repo execbit
>>>>> +#require test-repo
>>>>> $ cd "`dirname "$TESTDIR"`"
>>>>> -look for python scripts without the execute bit
>>>>> +look for python scripts that do not use /usr/bin/env
>>>>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>>>>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env
>>>>> python")'
>>>>>  [1]
>>>>> -look for python scripts with execute bit but not shebang
>>>>> +look for shell scripts that do not use /bin/sh
>>>>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>>>>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>>>  [1]
>>>> 
>>>> 
>>>> Is there a way to lose these lines other than `grep -v`?
>>>> 
>>>>  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>> +  obsolete feature not enabled but 110079 markers found!
>>>>  [1]
>>>> 
>>>> (I'm a bit surprised nobody else is seeing this?)
>>>> 
>>>> _______________________________________________
>>>> Mercurial-devel mailing list
>>>> Mercurial-devel@mercurial-scm.org
>>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
timeless - April 17, 2016, 4:45 a.m.
Hrm, perhaps not. I'm so used to grep for which it was

On Sun, Apr 17, 2016 at 12:03 AM, Matt Harbison <mharbison72@gmail.com> wrote:
>
>> On Apr 16, 2016, at 11:51 PM, timeless <timeless@gmail.com> wrote:
>>
>> hrm, ok. well, it'd need to be (?),
>> if you don't use obsolete markings in your repo, then the output
>> wouldn't happen.
>>
>> so 2>&1 + (?) seems reasonable.
>
> Since the tests also capture stderr, is the redirect even necessary?
>
>>
>> It is a bunch of files though (I think at least 3).
>>
>> It definitely happens on linux too (gcc112 where I do my work).
>>
>>> On Sat, Apr 16, 2016 at 11:40 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>>>
>>>> On Apr 16, 2016, at 11:22 PM, timeless <timeless@gmail.com> wrote:
>>>>
>>>> I hit them all the time. I've complained but never gotten any
>>>> particular help in quieting them. When I suggested 2> /dev/null, I'm
>>>> pretty sure someone complained. Also, I had to add them to quite a few
>>>> places, which really sucked :(
>>>
>>> I'm not keen on throwing away stderr either.  We could put a (?) on the end, since I don't really care what output is captured- it's the false positive that's annoying.  I just wanted to make sure that there wasn't a real issue before burying it.  (E.g., there something wrong with one of the perf tests where it doesn't seem to set HGRCPATH to empty properly on Windows, so it tries and fails to load keyring from the user hgrc, which shows as a diff.  I want to fix that, not hide it.)
>>>
>>>
>>>>>> On Fri, Apr 15, 2016 at 10:19 PM, Matt Harbison <mharbison72@gmail.com> wrote:
>>>>>> On Wed, 06 Apr 2016 21:26:37 -0400, timeless <timeless@mozdev.org> wrote:
>>>>>>
>>>>>> # HG changeset patch
>>>>>> # User timeless <timeless@mozdev.org>
>>>>>> # Date 1459969752 0
>>>>>> #      Wed Apr 06 19:09:12 2016 +0000
>>>>>> # Node ID 16e6523533e263430f06ffd785c921a114268199
>>>>>> # Parent  0a413e125a885f3b5349aa8aaa8d7285fbcbdd3e
>>>>>> tests: add new test for #! shbang lines
>>>>>>
>>>>>> * use #!/bin/sh not e.g. #!/usr/bin/sh
>>>>>> * use #!/usr/bin/env python not e.g. #!/usr/bin/python
>>>>>>
>>>>>> diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
>>>>>> copy from tests/test-check-execute.t
>>>>>> copy to tests/test-check-shbang.t
>>>>>> --- a/tests/test-check-execute.t
>>>>>> +++ b/tests/test-check-shbang.t
>>>>>> @@ -1,23 +1,13 @@
>>>>>> -#require test-repo execbit
>>>>>> +#require test-repo
>>>>>> $ cd "`dirname "$TESTDIR"`"
>>>>>> -look for python scripts without the execute bit
>>>>>> +look for python scripts that do not use /usr/bin/env
>>>>>> -  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
>>>>>> +  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env
>>>>>> python")'
>>>>>>  [1]
>>>>>> -look for python scripts with execute bit but not shebang
>>>>>> +look for shell scripts that do not use /bin/sh
>>>>>> -  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
>>>>>> +  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>>>>  [1]
>>>>>
>>>>>
>>>>> Is there a way to lose these lines other than `grep -v`?
>>>>>
>>>>>  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
>>>>> +  obsolete feature not enabled but 110079 markers found!
>>>>>  [1]
>>>>>
>>>>> (I'm a bit surprised nobody else is seeing this?)
>>>>>
>>>>> _______________________________________________
>>>>> Mercurial-devel mailing list
>>>>> Mercurial-devel@mercurial-scm.org
>>>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/test-check-execute.t b/tests/test-check-shbang.t
copy from tests/test-check-execute.t
copy to tests/test-check-shbang.t
--- a/tests/test-check-execute.t
+++ b/tests/test-check-shbang.t
@@ -1,23 +1,13 @@ 
-#require test-repo execbit
+#require test-repo
 
   $ cd "`dirname "$TESTDIR"`"
 
-look for python scripts without the execute bit
+look for python scripts that do not use /usr/bin/env
 
-  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
+  $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bin/env python")'
   [1]
 
-look for python scripts with execute bit but not shebang
+look for shell scripts that do not use /bin/sh
 
-  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
+  $ hg files 'set:grep(r"^#!.*/bin/sh") and not grep(r"^#!/bin/sh")'
   [1]
-
-look for shell scripts with execute bit but not shebang
-
-  $ hg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
-  [1]
-
-look for non scripts with no shebang
-
-  $ hg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
-  [1]