File hplip-fix-python-crash-in-avahi.py.patch of Package hplip

From 0045bcf5646e6e24a7f1701dc91be722a93bfb73 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 19 Aug 2025 23:38:24 +0200
Subject: [PATCH 28/33] hplip: fix python crash in avahi.py

The avahi search method may crash on MDNS records that have
an empty "details" field (field 9). This can happen e.g. for
existing shared local printers advertized by cups.
---
 base/avahi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/avahi.py b/base/avahi.py
index b82a089..f168585 100755
--- a/base/avahi.py
+++ b/base/avahi.py
@@ -43,7 +43,7 @@ def detectNetworkDevices(ttl=4, timeout=10):
     for line in output.splitlines():
         if line.startswith('='):
             bits = line.split(';')
-            if bits[2] == 'IPv4' and len(bits[7].split('.')) == 4:
+            if bits[2] == 'IPv4' and len(bits[7].split('.')) == 4 and bits[9] != "":
                 ip = bits[7]
                 port = bits[8]
                 # Run through the offered addresses and see if we have a bound local
-- 
2.52.0

openSUSE Build Service is sponsored by