[R-pkg-team] Bug#1042406: dh-r: throws "Use of uninitialized value $dep_line in substitution" warnings with some packages
Nilesh Patra
nilesh at debian.org
Thu Jul 27 19:21:42 BST 2023
Package: dh-r
Version: 20230722
Severity: important
Tags: patch
Dear Maintainer,
As discussed on matrix chan, it seems that during build of some R
packages, there's output such as this:
Use of uninitialized value $dep_line in substitution (s///) at /usr/share/perl5/Dpkg/Deps.pm line 300.
Use of uninitialized value $dep_line in substitution (s///) at /usr/share/perl5/Dpkg/Deps.pm line 302.
Use of uninitialized value $dep_line in substitution (s///) at /usr/share/perl5/Dpkg/Deps.pm line 303.
Use of uninitialized value $dep_line in split at /usr/share/perl5/Dpkg/Deps.pm line 306.
shown on the build log. As seen in https://salsa.debian.org/r-pkg-team/r-bioc-rtracklayer/-/jobs/4478926#L1890
On checking further, it seems to be stemming from the recommends line in
dh-r code[1]. This is because recommendsinput variable is being directly
set from desc->{Recommends}, and a check of whether this field is empty
is *after* the said initialization[3]. This can lead to `recommendsinput`
being set as `undef` and hence the unintialized errors from debhelper.
The reason that we don't see such problems in for instance
r-bioc-bsgenome is because it has some values in the testdepends and
recommendsinput ends up having some value[4].
I have attached a patch to fix this, please check.
** Please test properly before you merge and upload, do NOT upload
blindly **
PS: Please mention my contribution in d/ch if you take this patch.
[1]: https://salsa.debian.org/r-pkg-team/dh-r/-/blob/debian/20230722/dh/R.pm#L229
[2]: https://salsa.debian.org/r-pkg-team/dh-r/-/blob/debian/20230722/dh/R.pm#L201
[3]: https://salsa.debian.org/r-pkg-team/dh-r/-/blob/debian/20230722/dh/R.pm#L224
[4]: https://salsa.debian.org/r-pkg-team/dh-r/-/blob/debian/20230722/dh/R.pm#L221
-- System Information:
Debian Release: 12.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-9-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_IN, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US.UTF-8
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages dh-r depends on:
ii dctrl-tools 2.24-3+b1
ii debhelper 13.11.4
ii libfile-which-perl 1.27-2
pn libswitch-perl <none>
pn libwww-curl-simple-perl <none>
ii r-base-dev 4.2.2.20221110-2
Versions of packages dh-r recommends:
ii cme 1.038-1
ii devscripts 2.23.3
ii git-buildpackage 0.9.30
Versions of packages dh-r suggests:
pn postgresql-client-common <none>
-------------- next part --------------
>From 91285e0d6e725892d2b66f1f890850eb98ddc0bc Mon Sep 17 00:00:00 2001
From: Nilesh Patra <nilesh at nileshpatra.info>
Date: Thu, 27 Jul 2023 18:07:43 +0000
Subject: [PATCH] Fix Recommends properly
---
dh/R.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dh/R.pm b/dh/R.pm
index e7682ef..0b35e94 100644
--- a/dh/R.pm
+++ b/dh/R.pm
@@ -198,6 +198,7 @@ sub install {
my %apthash;
@apthash{@aptavail} = ();
+ if ( ! $desc->{Recommends} ) { $desc->{Recommends} = ""; }
my $recommendsinput = $desc->{Recommends};
# Add DEP8 test dependencies to Recommends to enable running test suite once the package is installed
if ( $testdepends ) {
@@ -218,10 +219,11 @@ sub install {
}
$newsuggests =~ s/^, // ;
$desc->{Suggests} = $newsuggests ;
+
$recommendsinput = $recommendsinput . ', ' . $testdepends ;
+ $recommendsinput =~ s/^, // ;
}
if ( ! $desc->{Depends} ) { $desc->{Depends} = ""; }
- if ( ! $desc->{Recommends} ) { $desc->{Recommends} = ""; }
if ( ! $desc->{Suggests} ) { $desc->{Suggests} = ""; }
if ( ! $desc->{Imports} ) { $desc->{Imports} = ""; }
if ( ! $desc->{LinkingTo} ) { $desc->{LinkingTo} = ""; }
--
2.40.1
More information about the R-pkg-team
mailing list