Hi!

On Wed, 2024-06-12 at 15:42:57 +0200, Guillem Jover wrote:
> On Wed, 2024-06-12 at 10:36:52 +0200, Martin Quinson wrote:
> > Le mercredi 12 juin 2024 à 04:47 +0200, Guillem Jover a écrit :
> > > Package: po4a
> > > Version: 0.70
> > > Severity: serious

> > Could you please do the following steps, please?
> 
> >  * Try whether the failure still happens with the latest po4a
> >  * Try whether the attached patch applied to the latest po4a helps
> >  * Tell me more details about how to reproduce the failure
> > 
> > Thanks in advance, and sorry for the inconvenience. To me, this part of po4a
> > code was not changed in years, so I need help to understand the issue.
> 
> It looked like at least the initial regression was introduced in po4a
> commit b2333d54845976f4804f024b5cea61db16fb4f36.

Ah, and missed that the later error I got was precisely the one being
emitted by that commit, which if you do not trigger then you'd not see
the earlier undefined symbol errors.

> > diff --git a/lib/Locale/Po4a/Pod.pm b/lib/Locale/Po4a/Pod.pm
> > index 4b3dc042..bd3d5c1a 100644
> > --- a/lib/Locale/Po4a/Pod.pm
> > +++ b/lib/Locale/Po4a/Pod.pm
> > @@ -27,6 +27,8 @@ use vars qw(@ISA);
> >  
> >  use Carp qw(croak confess);
> >  
> > +use Locale::Po4a::Common qw(dgettext);
> > +
> >  sub initialize { }
> >  
> >  sub translate {
> 
> I hot-edited this in my installed system and then got:
> 
>   ,---
>     PO4A   man.stamp
>   Undefined subroutine &Locale::Po4a::Pod::wrap_mod called at 
> /usr/share/perl5/Locale/Po4a/Pod.pm line 96, <$fh> line 21.
>   make[2]: *** [Makefile:902: man.stamp] Error 255
>   `---
> 
> I then instead removed the import restrictions and simply added:
> 
>   ,---
>   use Locale::Po4a::Common;
>   `---
> 
> That fixed that issue but then it fails with:
> 
>   ,---
>     PO4A   man.stamp
>   po4a::pod: The file deb-buildinfo.pod declares utf8 as encoding, but you 
>              provided UTF-8 as master charset. Please change either setting.
>    at /usr/bin/po4a line 1663.
>   make[2]: *** [Makefile:902: man.stamp] Error 255
>   `---

I think the charset comparison is too naive though, and does not cover
for example any aliases listed in «man Encode::Supported». I think a
better comparison logic could look like this:

  ,---
  use Encode;

  my $enc_charset = Encode::find_encoding($charset);
  my $enc_master_charset = Encode::find_encoding($master_charset);

  say 'match' if $enc_charset->mime_name eq $enc_master_charset->mime_name;
  `---

Unfortunately neither Encode::find_encoding()->name nor
Encode::resolve_alias() seem helpful here because they return
"utf-8-strict" for "UTF-8" which will not match against "utf-8" for
the canonical "utf8".

I'm not sure whether lib/Locale/Po4a/Xml.pod might need a similar
treatment, because that might depend on what encodings are supported
in there, against what is supported in po4a I guess.

Thanks,
Guillem

Reply via email to