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

guillem pushed a commit to branch master
in repository dpkg.

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

commit fe370de1e518de34db2d97c1d1ccc141141bf3fc (HEAD -> master)
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Jun 26 07:09:57 2020 +0200

    dpkg-realpath, dpkg-m-h: Normalize root directory
    
    First use realpath on the root directory, then handle the default root
    directory case («/») by setting the root directory to an empty string.
---
 scripts/dpkg-maintscript-helper.sh | 4 ++++
 scripts/dpkg-realpath.sh           | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/scripts/dpkg-maintscript-helper.sh 
b/scripts/dpkg-maintscript-helper.sh
index 1c7e17eed..a4fb1e750 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -594,6 +594,10 @@ set -e
 PROGNAME=$(basename "$0")
 version="unknown"
 DPKG_ROOT=${DPKG_ROOT:+$(realpath "$DPKG_ROOT")}
+# Remove default root dir.
+if [ "$DPKG_ROOT" = "/" ]; then
+  DPKG_ROOT=""
+fi
 export DPKG_ROOT
 
 PKGDATADIR=scripts
diff --git a/scripts/dpkg-realpath.sh b/scripts/dpkg-realpath.sh
index feba0eae4..95de7e52e 100755
--- a/scripts/dpkg-realpath.sh
+++ b/scripts/dpkg-realpath.sh
@@ -149,6 +149,13 @@ while [ $# -ne 0 ]; do
   shift
 done
 
+# Normalize root directory.
+DPKG_ROOT="${DPKG_ROOT:+$(realpath "$DPKG_ROOT")}"
+# Remove default root dir.
+if [ "$DPKG_ROOT" = "/" ]; then
+  DPKG_ROOT=""
+fi
+
 [ -n "$pathname" ] || badusage "missing pathname"
 if [ "${pathname#"$DPKG_ROOT"}" != "$pathname" ]; then
   error "link includes root prefix"

-- 
Dpkg.Org's dpkg

Reply via email to