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

Bug#834797: lintian: depends on libdata-alias-perl, broken with Perl 5.24



On Fri, Aug 19, 2016 at 01:37:36PM +0200, Jakub Wilk wrote:
> 
> * Niko Tyni <ntyni@debian.org>, 2016-08-19, 09:42:
> > This package depends and/or build-depends on libdata-alias-perl, which
> > breaks with Perl 5.24 (currently in experimental.)
> 
> This dependency was added in 516add8dc237 "to avoid copying large texts in
> memory". But my understanding is that Perl >= 5.20 has copy-on-write
> strings[0], so this optimization is no longer necessary. Jessie has a
> sufficiently new version, so the use of Data::Alias can be safely dropped.
> 
> [0] http://perldoc.perl.org/perl5200delta.html#Performance-Enhancements

Thanks for looking at this! That makes sense to me fwiw, but I see in
#795641 that the patch author was using 5.20 at least when sending the
patch. So presumably there was a reason for this? 

> > In some cases the 'refaliasing' feature in Perl >= 5.22 may be a
> > replacement;
> 
> (Lintian needs to be backportable to stable, so we couldn't easily use this
> feature yet.)

Sure. I managed to get both alternatives working at the same time with a
string eval for the newer syntax, but it does feel a bit fragile. Something
like

  #!/usr/bin/perl -w
  use strict;
  
  use if $] >= 5.022, feature => 'refaliasing';
  no  if $] >= 5.022, warnings => 'experimental::refaliasing';
  use if $]  < 5.022, 'Data::Alias';
  
  my $b = "A" x (1024 * 1000 * 1000);
  
  if ($] >= 5.022) {
      eval '\$a = \$b';
  } else {
      alias $a = $b;
  }
  
  print \$a, "\n";
  print \$b, "\n";

which would enable a backports-friendly dependency like

Depends: perl (>= 5.22) | libdata-alias-perl

Does that seem feasible?
-- 
Niko Tyni   ntyni@debian.org


Reply to: