Package: config-package-dev
Version: 5.2
Severity: normal
Tags: patch

Dear Maintainer,

When using the transform operation dh_configpackage will output that kind
of error:

Can't use string ("/ARRAY(0x55f37e2c3080)") as an ARRAY ref while
"strict refs" in use at /usr/bin/dh_configpackage line 394.

This error has been introduced by the correction of:
#803962 : config-package-dev: Requires leading slashes un debian/*.displace

For this correction we iterrate through the differents operation arrays to
add a leading slash if needed.
The problem is that @transformfiles is an array of array since it's created
with filedoublearray function and not the filearray function like the others
operation arrays (which are simples arrays).
This lead to an add of a slash in front of the reference array ARRAY(0xXXX...)
as can be seen in the error message.
Subsequent processing of transformfiles results in an error.

I've attached a patch with a way to fix this issue by removing transformfiles
from the leading slashes verification loop and by checking leading slashes in
the treatment of transformfiles itself as it was done before.

Note that I've triggered the error in a Debian testing environment and
the stable version is not affected.

Best regards,
Bruno

-- System Information:
Debian Release: 9.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
From 41bd411b4104982f05d63b7e1738591ba357ab7a Mon Sep 17 00:00:00 2001
From: Bruno Maitre <[email protected]>
Date: Fri, 1 Sep 2017 17:25:09 +0200
Subject: [PATCH] dh_configpackage: Fix leading slashes check for the transform
 operation

---
 dh_configpackage | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dh_configpackage b/dh_configpackage
index ba1b060..ab6f067 100755
--- a/dh_configpackage
+++ b/dh_configpackage
@@ -376,7 +376,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
         @transformfiles = filedoublearray($transformfile) if $transformfile;
     }
 
-    foreach my $listref (\@displacefiles, \@hidefiles, \@undisplacefiles, \@unhidefiles, \@transformfiles) {
+    foreach my $listref (\@displacefiles, \@hidefiles, \@undisplacefiles, \@unhidefiles) {
         foreach my $file (@$listref) {
             $file =~ s|^/?|/|;
         }
@@ -392,6 +392,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
     foreach my $line (@transformfiles) {
         my $file = shift @$line;
+        $file =~ s|^/?|/|;
         my $source;
         my $source_is_local = 0;
         if (@$line[0] =~ /^</) {
-- 
2.11.0

Reply via email to