[Xenial][SRU][PATCH 1/1] UBUNTU: [Debian] autoreconstruct - add resoration of execute permissions

Po-Hsu Lin po-hsu.lin at canonical.com
Wed Feb 5 12:24:59 UTC 2020


From: Seth Forshee <seth.forshee at canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1861973

Debian source package diffs cannot represent that a file should
be executable. This is a problem for us if a patch adds a script
which is invoked directly during the build, as happened with a
recent stable update for 4.14. Update gen-auto-reconstruct to
detect this situation and restore the execute permissions in the
reconstruct script. Exclude the debian packaging directories as
the scripts here already account for the loss of execute
permissions.

Signed-off-by: Seth Forshee <seth.foddrshee at canonical.com>
Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
 debian/scripts/misc/gen-auto-reconstruct | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/debian/scripts/misc/gen-auto-reconstruct b/debian/scripts/misc/gen-auto-reconstruct
index acc90fe..b20551e 100755
--- a/debian/scripts/misc/gen-auto-reconstruct
+++ b/debian/scripts/misc/gen-auto-reconstruct
@@ -42,6 +42,23 @@ fi
 		echo "rm -f '$name'"
 	done
 
+	# Identify files with execute permissions added since the proffered tag.
+	git diff "$tag.." --raw --no-renames | awk -F '[: \t]' '{print $2, $3, $NF }' | \
+	while IFS=" " read old new name
+	do
+		# Exclude files in debian* directories
+		if [[ "$name" =~ ^debian ]]; then
+			continue
+		fi
+
+		old=$( printf "0%s" $old )
+		new=$( printf "0%s" $new )
+		changed=$(( (old ^ new) & 0111 ))
+		if [ "$changed" -ne 0 ]; then
+			echo "chmod +x '$name'"
+		fi
+	done
+
 	# All done, make sure this does not complete in error.
 	echo "exit 0"
 ) >"$reconstruct"
-- 
2.7.4




More information about the kernel-team mailing list