Bug#1010241: libdebian-source-perl: Incorrect case sensitivity in Debian::Control::Stanza::new for field names

Alex Muntada alexm at debian.org
Thu Apr 28 00:58:14 BST 2022


Hi gregor!

> And then I found the following d/changelog entry for 0.95:
> 
>   [ Alex Muntada ]
>   * Debian::Control::Stanza: accept case-insensitive field names in new()
>     as required by Debian Policy while retaining the canonical accessors.
>     Thanks to Ben Finney for the bug report. (Closes: #860023)

Wow, I totally forgot that :)

> But yeah, it's not only a déjà-vu, apparently we need to take a look
> at this part of the code again …

Here's a proof of concept:

```
#!perl
use strict;
use warnings;
use v5.30;

use Debian::Control::Stanza::Source;
#use Debian::Control::Stanza::Binary;
my %stanza = (
    'Source' => 'package-name',
    'VCS-GIT' => 'test-vcs-git',
);
my $s = Debian::Control::Stanza::Source->new(\%stanza);
say $s->Vcs_Git;
```

It works as expected unless you uncomment the use of the
Stanza::Binary package. Then it fails:

```
Invalid field given (VCS_GIT) at case-insensitive.pl line 12.
```

That's because the import in D::C::Stanza is called twice and
the $class->fields is different for ::Source than ::Binary.
I think we need to move the canonicalization to the constructor
instead (see the patch attached, that seems to work and passes
t/Control.t too).

HTH

--
  ⢀⣴⠾⠻⢶⣦⠀
  ⣾⠁⢠⠒⠀⣿⡁   Alex Muntada <alexm at debian.org>
  ⢿⡄⠘⠷⠚⠋   Debian Developer 🍥 log.alexm.org
  ⠈⠳⣄⠀⠀⠀⠀

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1010241.patch
Type: text/x-diff
Size: 736 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20220428/d95e512f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20220428/d95e512f/attachment.sig>


More information about the pkg-perl-maintainers mailing list