This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=5e46449fdfbc1901af04a98ea2312a8440d2cd80

commit 5e46449fdfbc1901af04a98ea2312a8440d2cd80
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Thu Jan 18 03:52:41 2024 +0100

    debian: Check for usrmerge in bug-script on the same vendors as postinst
    
    Make both scripts emit the warning on the same vendors. We duplicate the
    logic for now, because the code in postinst emits colors, and introducing
    a new shell library is potentially problematic for the maintscript, as
    that can end up as a forever interface. And this check is supposed to
    disappear eventually. If the get_vendor function proves useful it can
    always be made into a shell library.
---
 debian/bug-script | 53 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 44 insertions(+), 9 deletions(-)

diff --git a/debian/bug-script b/debian/bug-script
index a46342a99..92b933da1 100644
--- a/debian/bug-script
+++ b/debian/bug-script
@@ -1,12 +1,47 @@
 #!/bin/sh
 
-for d in /bin /sbin /lib /lib32 /libo32 /libx32 /lib64; do
-  linkname="$(readlink $d)"
-  if [ "$linkname" = "usr$d" ] || [ "$linkname" = "/usr$d" ]; then
-    echo "This system uses merged-usr-via-aliased-dirs, going behind dpkg's" 
>&3
-    echo "back, breaking its core assumptions. This can cause silent file" >&3
-    echo "overwrites and disappearances, and its general tools misbehavior." 
>&3
-    echo "See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>." >&3
-    break
+get_vendor()
+{
+  local origin="$DPKG_ROOT/etc/dpkg/origins/default"
+  local vendor
+
+  if [ -n "$DEB_VENDOR" ]; then
+    vendor="$DEB_VENDOR"
+  elif [ -e "$origin" ]; then
+    vendor=$(sed -ne 's/^Vendor: *\([^ ]\+\) */\1/p' "$origin" | tr A-Z a-z)
   fi
-done
+
+  echo "${vendor:-default}"
+}
+
+check_merged_usr_via_aliased_dirs()
+{
+  local vendor
+
+  vendor=$(get_vendor)
+
+  case "$vendor" in
+  debian)
+    # In Debian some people have gotten so offended by the following _warning_
+    # that they have resorted to bullying and abuse. Life's too short, sorry.
+    return
+    ;;
+  ubuntu)
+    # Ubuntu does not seem interested in it.
+    return
+    ;;
+  esac
+
+  for d in /bin /sbin /lib /lib32 /libo32 /libx32 /lib64; do
+    linkname="$(readlink $d)"
+    if [ "$linkname" = "usr$d" ] || [ "$linkname" = "/usr$d" ]; then
+      echo "This system uses merged-usr-via-aliased-dirs, going behind dpkg's" 
>&3
+      echo "back, breaking its core assumptions. This can cause silent file" 
>&3
+      echo "overwrites and disappearances, and its general tools misbehavior." 
>&3
+      echo "See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>." >&3
+      break
+    fi
+  done
+}
+
+check_merged_usr_via_aliased_dirs

-- 
Dpkg.Org's dpkg

Reply via email to