Source: libxml-stream-perl
Followup-For: Bug #692311

Here is a suggested patch. Can someone forward that upstream? I would
like to get this fixed as soon as possible, so would rather upload an
NMU with this patch in the next couple of days anyway. But I would
appreciate this being forwarded on my behalf.

Thanks.
Cascardo.


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.7.0-3-amd64 (SMP w/2 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information
>From 6f085fab67ba07ff38284f9fb865a7eb29346460 Mon Sep 17 00:00:00 2001
From: Thadeu Lima de Souza Cascardo <casca...@debian.org>
Date: Wed, 20 Jan 2021 13:02:16 -0300
Subject: [PATCH] Do not die when hostname cannot be resolved.

In case the local hostname cannot be resolved, use it instead of the
full reverse name, as it would have been done in case the reverse would
not work.

Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@debian.org>
---
 lib/XML/Stream.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/XML/Stream.pm b/lib/XML/Stream.pm
index 410a7c4..4c993e2 100644
--- a/lib/XML/Stream.pm
+++ b/lib/XML/Stream.pm
@@ -205,8 +205,7 @@ sub new
     XML::Stream::Tools::setup_debug($self, %args); 
 
     my $hostname = hostname();
-    my $address = gethostbyname($hostname) ||
-        die("Cannot resolve $hostname: $!");
+    my $address = gethostbyname($hostname) || "";
     my $fullname = gethostbyaddr($address,AF_INET) || $hostname;
 
     $self->debug(1,"new: hostname = ($fullname)");
-- 
2.30.0

Reply via email to