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

Bug#231770: lintian: Add checks for prompting in maintainerscripts



Luk Claes <luk@debian.org> writes:
> Russ Allbery wrote:

>> My concern about the simple approach to this (which I never sent to the
>> bug; my bad) is that the other major use of read besides prompting is
>> for parsing files.  It's not uncommon to see a construct like:
>> 
>>     while read facility destination ; do
>>         # do something with facility and destination
>>     done < /etc/syslog.conf
>> 
>> Your patch won't produce false positives with this, but I don't know if
>> there are any scripts that do something similar but don't use that
>> explicit of a loop.  I don't see any in a quick check on my system, but
>> I only have a few packages installed.

> I would be surprised to see it happen, but if it happens we can always
> improve the checking, no?

True.

> Why would essential packages not try to use debconf if available?

Good point.

Okay, applying this now, with just a few changes:

 * This check should only be inside the if test for whether this is a
   shell script, since read may mean something else entirely in another
   language.

 * It should ignore information inside heredocs (one of the tests in the
   lintian test suite checks this).

 * Skipping based on /usr/share/debconf/confmodule instead of db_input is
   better, since some scripts do:

       if ! test -f /usr/share/debconf/confmodule ; then
           # some code that uses read
       fi

Thank you very much for the contribution!

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



Reply to: