On Mon, Mar 20, 2017 at 4:32 PM, Bastien ROUCARIES
<roucaries.bast...@gmail.com> wrote:
> control: tags -1 + patch
>
> Hi,
>
> Found joinded patch to honor DPKG_ROOT. Tested using test suite

Improve portability by not using find -printf
From a251b8f7aadd33203d26db3a61f9431bf9c4ac22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bast...@gmail.com>
Date: Mon, 20 Mar 2017 17:01:42 +0100
Subject: [PATCH 6/6] Improve portability by not using find -printf

---
 scripts/dpkg-maintscript-helper.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index 5becba33a..e8f4c662c 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -412,20 +412,20 @@ prepare_dir_to_symlink()
 
 	# If there are locally created files or files owned by another package
 	# we should not perform the switch.
-	if [ -n "$DPKG_ROOT" ]; then
+	if [ -z "$DPKG_ROOT" ]; then
 	        find "$PATHNAME" -print0 | xargs -0 -n1 \
 		       dpkg-maintscript-helper package_owns_file_or_error $PACKAGE || \
 		              error "directory '$PATHNAME' contains files not owned by" \
 		                    "package $PACKAGE, cannot switch to symlink"
 	else
-	    find "$DPKG_ROOT$PATHNAME" -printf "%P\0" | xargs -0 -n1 \
+	    (cd "$DPKG_ROOT$PATHNAME"; find ./ -print0 | xargs -0 -n1 \
 		       sh -c '
-		       	  file=$2
-			  pathname=$1
-		       	  echo -n "$pathname/$file"; printf "\0"' \
-			  addpathname $PATHNAME | \
+		          file=$2;
+			  pathname=$1;
+			  echo -n $file |sed s,[.]/,$pathname/,g ;printf "\0"' \
+		       findhelper $PATHNAME | \
 		       xargs -0 -n1 \
-		       dpkg-maintscript-helper package_owns_file_or_error $PACKAGE || \
+		       dpkg-maintscript-helper package_owns_file_or_error $PACKAGE) || \
 		              error "directory '$PATHNAME' contains files not owned by" \
 		                    "package $PACKAGE, cannot switch to symlink"
 	fi
-- 
2.11.0

Reply via email to