Package: devscripts
Version: 2.16.5
Severity: important
Tags: patch
User: debian-p...@lists.debian.org
Usertags: perl-5.24-transition

This package fails to build with Perl 5.24 (currently in experimental):

  ./test_dd-list
  testBinariesFromSameSource
  E: Unknown package: vim-nox
  E: Unknown package: vim-gtk
  E: Unknown package: 
/build/devscripts-yjxbvh/devscripts-2.16.5/test/dd-list/sources
  ASSERT:packages found expected:<0> but was:<1>
  testExtraSourceOnlyIgnored
  E: Unknown package: bzip2
  E: Unknown package: 
/build/devscripts-yjxbvh/devscripts-2.16.5/test/dd-list/sources
  testUseOnlyLatestVersion
  E: Unknown package: 
/build/devscripts-yjxbvh/devscripts-2.16.5/test/dd-list/sources
  E: Unknown package: subversion
  
  Ran 3 tests.
  
  FAILED (failures=1)
  Makefile:18: recipe for target 'test_dd-list.test' failed

A full build log is available at
  http://perl.debian.net/rebuild-logs/perl-5.24-throwaway/devscripts_2.16.5/
 
It looks like dd-list option parsing is affected by a change in Getopt::Long:
it's specifying 

  use Getopt::Long qw(:config gnu_getopt);
  [...]
  GetOptions([...], "sources|s:s@" => \$source_files, [...])

and calling dd-list in the test suite with
  scripts/dd-list.pl -s test/dd-list/sources vim-gtk vim-no

which now leaves $source_files empty and test/dd-list/sources in @ARGV.

This seems to be an intentional bufix change in Getopt::Long, see
 https://rt.cpan.org/Public/Bug/Display.html?id=39052
which says that GNU getopt compatibility means optional arguments
need to be passed with '=' on the command line, i.e.
  scripts/dd-list.pl -s=test/dd-list/sources vim-gtk vim-no

A test case is
  #!/usr/bin/perl -w
  use strict;
  use Getopt::Long qw(:config gnu_compat);
  my $files = [];
  GetOptions('f:s@' => \$files);
  print "got @$files, ARGV left: @ARGV\n";

which, when called as 't.pl -f foo bar' indeed behaves differently on
5.22 vs. 5.24.

I'm not sure what the use case for an empty '-s' option is?  It seems
like leaving '-s' out altogether gives the default behaviour of looking
for sources files in /var/lib/apt/lists, so it should be fine to require
a file argument to go with the '-s' option?

If that's the case, the attached patch should be enough to fix this. I've
verified it makes the package build on both Perl 5.22 and 5.24.
-- 
Niko Tyni   nt...@debian.org
>From 253021cafc14af9c70b8380e91b5c3796d655125 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Sun, 5 Jun 2016 12:57:38 +0300
Subject: [PATCH] dd-list: make the file argument of the '-s' option mandatory

As discussed in https://rt.cpan.org/Public/Bug/Display.html?id=39052
dd-list was relying on buggy Getopt::Long behaviour to parse 'dd-list -s
<sources>': GNU getopt compatibility would require 'dd-list -s=<sources>'
for optional arguments.

There doesn't seem to be a use case for specifying '-s' without a
source file, so fix the problem by making it mandatory.
---
 scripts/dd-list.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/dd-list.pl b/scripts/dd-list.pl
index 71f277c..f7c4b50 100755
--- a/scripts/dd-list.pl
+++ b/scripts/dd-list.pl
@@ -100,7 +100,7 @@ GetOptions(
     "help|h" => sub { help(); exit },
     "stdin|i" => \$use_stdin,
     "dctrl|d" => \$use_dctrl,
-    "sources|s:s@" => \$source_files,
+    "sources|s=s@" => \$source_files,
     "uploaders|u!" => \$show_uploaders,
     'z|uncompress' => \$opt_uncompress,
     "print-binary|b" => \$print_binary,
-- 
2.8.1

Reply via email to