tags +patch

thanks

(can i also send control commands here, or only to cont...@bugs.debian.org? i will know after sending this email)


Hi Niels,

> I am inclined to go with option C by having `_strip_spaces` cope with
> its input being undefined and just immediately returning (or skipping
> the stripping part).
>

I have created a patch and attached it to this mail.

Using command `debbuild` the package builds and i installed the resulting deb package and it seems to work; plus one of the many messages says:

> All tests successful.

So maybe all is fine? However my perl foo is not good enough to know how to test whether a perl warning is issued.


> Thanks for considering to provide a patch, it is very appreciated. :)
> I have already applied your patch from #1010591.  If you prefer, you
> are also very welcome to use salsa.debian.org to provide a merge
> request at
> https://salsa.debian.org/debian/debhelper/-/merge_requests

I have registered for an account now, but am of-course awaiting approval.


cya,

Max
From fb9e71aadaab92f9d4275a32593aed009c500d14 Mon Sep 17 00:00:00 2001
From: Max-Julian Pogner <max-jul...@pogner.at>
Date: Sat, 14 May 2022 21:48:01 +0200
Subject: [PATCH] Dh_Lib.pm: _strip_spaces now explicitly returns undef on
 undef argument.

_strip_spaces sometimes get's used to process optional source fields
such as for example the 'Section:' field. In this case, the argument
to _strip_spaces would be undef and without this patch perl issues a
warning message.

This patch makes _strip_space simply return undef in this case, assuming
that the caller of _strip_spaces is prepared to handle missing (optional)
source field as undef.

See bugs.debian.org: #1010594
---
 debian/changelog               | 3 +++
 lib/Debian/Debhelper/Dh_Lib.pm | 1 +
 2 files changed, 4 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1430e816..a7788c48 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ debhelper (13.7.2) UNRELEASED; urgency=medium
 
   [ Max-Julian Pogner ]
   * Dh_Lib.pm: Remove double semi-colon.  (Closes: #1010591)
+  * Dh_Lib.pm: _strip_spaces now explicitly returns undef on undef
+    argument.
+    (Closes: #1010594)
 
   [ Andrea Pappacoda ]
   * cmake.pm: Set FETCHCONTENT_FULLY_DISCONNECTED to true.  This
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 11053102..be79befa 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -1764,6 +1764,7 @@ sub getpackages {
 
 sub _strip_spaces {
 	my ($v) = @_;
+	return undef if not defined($v);
 	$v =~ s/^\s++//;
 	$v =~ s/\s++$//;
 	return $v;
-- 
2.35.2

Reply via email to