[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#536397: lintian: False positive with command-with-path-in-maintainer-script



Raphael Geissert <geissert@debian.org> writes:
> Adam D. Barratt wrote:
>> On Thu, 2009-07-09 at 09:58 -0700, Russ Allbery wrote:

>>> I think the fix is to change:

>>>     our $LEADIN = qr'(?:(?:^|[`&;(|{])\s*|(?:if|then|do|while)\s+)';

>>> to:

>>>     our $LEADIN =
>>>     qr'(?:(?:^|[&;(|{]|^[^`]*`)\s*|(?:if|then|do|while)\s+)';

>>> but I'm not sure and could use more review.

>> I can't find any obvious issues with it from a few tests, fwiw.

> I can.
>
> $ cat /tmp/prove
> #!/bin/sh
> true `basename "$0"` `echo -e "foo\nbar"`

How about:

our $LEADIN =
   qr'(?:(?:^|[&;(|{]|^(?:[^`]|`[^`]*`)*`)\s*|(?:if|then|do|while)\s+)';

Hm.  Although then I bet we get ourselves in trouble by matching too
much and don't check the command in the first backticks.

I'm not quite sure the best way to solve this.  Maybe extract all
backticked commands from the string and check them independently before
checking the main string?

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: