[SRU L, K, J, F, B][PATCH 1/1] UBUNTU: [Debian] autoreconstruct - fix restoration of execute permissions

Dimitri John Ledkov dimitri.ledkov at canonical.com
Tue Apr 25 09:26:47 UTC 2023


Hi,

On Thu, 6 Apr 2023 at 18:49, Roxana Nicolescu
<roxana.nicolescu at canonical.com> wrote:
>
> 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 at canonical.com>
> Signed-off-by: Roxana Nicolescu <roxana.nicolescu at canonical.com>
> ---
>  debian/scripts/misc/gen-auto-reconstruct | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/debian/scripts/misc/gen-auto-reconstruct b/debian/scripts/misc/gen-auto-reconstruct
> index 43ec90345055..a50ceb619f17 100755
> --- a/debian/scripts/misc/gen-auto-reconstruct
> +++ b/debian/scripts/misc/gen-auto-reconstruct
> @@ -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

Currently in lunar we have:

rm -f 'scripts/is_rust_module.sh'
...
chmod +x 'scripts/is_rust_module.sh'

so I wonder if our checks are still not quite right, as we detect
removals first; then detect executable permission changes....

I wonder if chmod & ln commands should happen before rm? Or skipped if
the file is deleted anyway?

-- 
okurrr,

Dimitri



More information about the kernel-team mailing list