[Pkg-utopia-maintainers] Bug#1009646: libnss-mdns uses perl in postrm script

Gioele Barabucci gioele at svario.it
Wed Apr 13 15:52:30 BST 2022


Package: libnss-mdns
Version: 0.15.1-1
Tags: patch

Dear maintainers of libnss-mdns,

the current postrm script of `libnss-mdns` requires Perl. Maintscripts
should not assume the existence of Perl in future systems.

The specific use of `perl` in this maintscript can be replaced
with an equivalent `sed` invocation, as in the following patch (also
available as a merge request at
<https://salsa.debian.org/debian/nss-mdns/-/merge_requests/1>)


diff --git a/debian/libnss-mdns.postrm b/debian/libnss-mdns.postrm
index ef3f90b..93ff69a 100644
--- a/debian/libnss-mdns.postrm
+++ b/debian/libnss-mdns.postrm
@@ -14,27 +14,10 @@ remove_mdns() {
          return
      fi
      log "Removing mdns from NSS setup"
-    perl -i -pe '
-        my @remove=(
-            "mdns4_minimal [NOTFOUND=return]",
-            "mdns4_minimal",
-            "mdns4",
-            "mdns6_minimal [NOTFOUND=return]",
-            "mdns6_minimal",
-            "mdns6",
-            "mdns_minimal [NOTFOUND=return]",
-            "mdns_minimal",
-            "mdns",
-        );
-        sub remove {
-            my $s=shift;
-            foreach my $bit (@remove) {
-                $s=~s/\s+\Q$bit\E//g;
-            }
-            return $s;
-        }
-        s/^(hosts:)(.*)/$1.remove($2)/e;
-    ' /etc/nsswitch.conf
+    sed -E -i /etc/nsswitch.conf \
+        -e '/^hosts:/s/\s+mdns4(_minimal)?(\s+\[NOTFOUND=return\])?//g' \
+        -e '/^hosts:/s/\s+mdns6(_minimal)?(\s+\[NOTFOUND=return\])?//g' \
+        -e '/^hosts:/s/\s+mdns(_minimal)?(\s+\[NOTFOUND=return\])?//g'
  }
  
  action="$1"


-- 
Gioele Barabucci



More information about the Pkg-utopia-maintainers mailing list