[pkg-go] Bug#885696: dh-golang: Avoid "Use of uninitialized value $args[192] in join or string" warnings

Chris Lamb lamby at debian.org
Fri Dec 29 09:36:08 UTC 2017


Source: dh-golang
Version: 1.26
Severity: normal
Tags: patch

Hi,

Due to the chunking algorithm used by dh_golang, we currently print
hundreds of warnings along the lines of:

  Use of uninitialized value $args[192] in join or string at /usr/bin/dh_golang line 42.
  Use of uninitialized value $args[193] in join or string at /usr/bin/dh_golang line 42.
  Use of uninitialized value $args[194] in join or string at /usr/bin/dh_golang line 42.
  […]

This is due to the manual list splicing in exec_chunked which will
return undefined variables.

Patch attached that uses Perl's slice operator instead. It seems to
work on at least golang-github-tjfoc-gmsm.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/script/dh_golang b/script/dh_golang
index 4b577a8..73ded48 100755
--- a/script/dh_golang
+++ b/script/dh_golang
@@ -55,7 +55,7 @@ sub exec_chunked {
 
     my @result;
     for (my $i = 0; $i < @list; $i += CHUNKSIZE) {
-        push @result, exec_single($cmd, @list[$i .. $i + CHUNKSIZE - 1]);
+        push @result, exec_single($cmd, splice(@list, $i, CHUNKSIZE));
     }
 
     return @result;


More information about the Pkg-go-maintainers mailing list