UBUNTU: [Debian] autoreconstruct - fix restoration of execute permissions

BugLink: http://bugs.launchpad.net/bugs/2015498

Debian source package diffs cannot represent that a file should be
executable.
gen-auto-reconstruct detects the situations where a file has changed
its permissions and restores the execute permissions in the
reconstruct script, assuming the file has always had execute permission.
This does not work in case a file removed the execute permission because
the script will change it back.

The script now adds either `chmod +x` or `chmod -x` based on the actual
permission change.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Cory Todd <cory.todd@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
Roxana Nicolescu
2023-04-06 19:49:05 +02:00
committed by Paolo Pisati
parent 5468fb2b62
commit fafa7da28c
+6 -1
View File
@@ -50,7 +50,12 @@ fi
new=$( printf "0%s" $new )
changed=$(( (old ^ new) & 0111 ))
if [ "$changed" -ne 0 ]; then
echo "chmod +x '$name'"
added=$(( new & 0111 ))
if [ "$added" -ne 0 ]; then
echo "chmod +x '$name'"
else
echo "chmod -x '$name'"
fi
fi
done