BOM: lintian

As you might have guessed from the previous posts, with BOM (Bug Of the Month) I want to take care of at least one bug from the Debian BTS each month.

Being a nice guy I have a five step plan in case a program does not work as expected.
1) read the manual
2) read the manual
3) ask my favourite search engine about that issue
4) read the manual
5) ask my favourite search engine about that issue
Unfortunately this plan totally failed while trying to understand the output of lintian. For an unknown reason I was always told that an init.d-script was not registered in debian/postinst. But I could see that seemingly missing call to updaterc.d

Looking at the PTS and the number of bugs for lintian, I decided that this might be the next entry. Fairly quickly I found the code where the error must be hidden. A bit shocked I was faced with something like:

  my $opts_r = qr/-\S+\s*/;
  my $name_r = qr/[\w.-]+/;
  my $action_r = qr/\w+/;

  /^(?:.+;|^\s*system[\s\(\']+)?\s*update-rc\.d\s+ (?:$opts_r)*($name_r)\s+($action_r)/xo;

At the sight of that regular expression I just wanted to run away and do some gardening (normally it is the other way around). After pulling up weeds for awhile, I sat down again and tried to decode that expression. Surprisingly it was not as difficult as expected before.

As a result #677142 containing a patch came into existence.

Result: regular expressions look strange but lift their secret after some time of thinking