]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: [Debian] autoreconstruct - add resoration of execute permissions
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 4 Jan 2018 20:41:30 +0000 (14:41 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 29 Jan 2018 13:45:08 +0000 (07:45 -0600)
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.forshee@canonical.com>
debian/scripts/misc/gen-auto-reconstruct

index acc90fe95a0c3c09856c38c5b79953cbd5d62644..b20551eba63588b538715d49cb813c298bf19a57 100755 (executable)
@@ -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"