Package: dpkg
Version: 1.18.23
Severity: important
affects: piuparts.debian.org
affects: src:imagemagick
control: tags -1 + patch

Hi guillem,

I know it is late on release but it will really help to add this patch.

Could you consider for release ?

Thank you

Bastien

commit 14814cd71ca2fac0857c51615dfcb0f6fd13655b
Author: Bastien ROUCARIÈS <[email protected]>
Date:   Wed Mar 15 12:10:07 2017 +0100

    Factorize owns_file

diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index b4b3ac1b3..0b867d805 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -412,14 +412,8 @@ prepare_dir_to_symlink()
 
 	# If there are locally created files or files owned by another package
 	# we should not perform the switch.
-	find "$PATHNAME" -print0 | xargs -0 -n1 sh -c '
-		package="$1"
-		file="$2"
-		if ! dpkg-query -L "$package" | grep -F -q -x "$file"; then
-			exit 1
-		fi
-		exit 0
-	' check-files-ownership "$PACKAGE" || \
+	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"
 
@@ -515,6 +509,18 @@ ensure_package_owns_file() {
 	return 0
 }
 
+
+package_owns_file_or_error() {
+       local PACKAGE="$1"
+       local FILE="$2"
+       if ! ensure_package_owns_file $PACKAGE $FILE ; then
+	   error "File '$FILE' not owned by package " \
+		 "'$PACKAGE'"
+	   return 1
+       fi
+       return 0
+}
+
 symlink_match()
 {
          local SYMLINK="$1"
@@ -614,6 +620,9 @@ symlink_to_dir)
 dir_to_symlink)
 	dir_to_symlink "$@"
 	;;
+package_owns_file_or_error)
+        package_owns_file_or_error "$@"
+        ;;
 --help|help|-?)
 	usage
 	;;

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to