Bug#860023: libdebian-source-perl: Rejects valid field names based on letter case
gregor herrmann
gregoa at debian.org
Thu Apr 13 19:40:10 UTC 2017
Control: tag -1 + patch pending
On Thu, 13 Apr 2017 15:54:19 +0200, Alex Muntada wrote:
> > So, with the above example, if each those field names were accepted,
> > and they all map to the Perl object accessor ‘Vcs_Git’, and other Perl
> > code still needed to spell the *accessor* name that way, that would
> > IMO be compliant with Policy and would resolve this bug report.
> The patch provided below accepts any valid field ignoring case
> by using the canonical name instead, so VCS-Git, vCS-gIT, etc.
> will end up being Vcs-Git. Would that be compliant with Policy?
Cool, this looks good to me.
(Now committed in git.)
To check what it's doing and that it's doing what we want I added
some tests to t/Control.t:
+# canonical / case-insensitive field names/accessors
+lives_ok { $s = Debian::Control::Stanza::Source->new({'Vcs_Git' => 'git://example.org'}) } 'Source constructur with Vcs_Git';
+can_ok($s, qw(Vcs_Git));
+ok($s->Vcs_Git eq 'git://example.org', 'Vcs_Git returns correct value');
+throws_ok { $s->vCs_GiT } qr/Can't locate object method "vCs_GiT" via package "Debian::Control::Stanza::Source"/, 'No method vCs_GiT';
+
+lives_ok { $s = Debian::Control::Stanza::Source->new({'vCs-GiT' => 'git://example.net'}) } 'Source constructur with vCs-GiT';
+can_ok($s, qw(Vcs_Git));
+ok($s->Vcs_Git eq 'git://example.net', 'Vcs_Git returns correct value');
+throws_ok { $s->vCs_GiT } qr/Can't locate object method "vCs_GiT" via package "Debian::Control::Stanza::Source"/, 'No method vCs_GiT';
So basically new({'Vcs_Git'.. and new({'vCs-GiT'.. both create a
working object, both actions have a working Vcs-Git() method which
returns the correct value, and both don't have a vCs_GiT() method.
If this is what we want, and I think see, we seem to be settled :)
Cheers,
gregor
--
.''`. https://info.comodo.priv.at/ - Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Don McLean: Wonderful baby
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: Digital Signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20170413/68e1ce7a/attachment.sig>
More information about the pkg-perl-maintainers
mailing list