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

Andrei Gherzan andrei.gherzan at canonical.com
Tue Apr 11 12:47:07 UTC 2023


On 23/04/11 02:38PM, Roxana Nicolescu wrote:
> 
> On 11/04/2023 14:26, Andrei Gherzan wrote:
> > On 23/04/06 07:49PM, Roxana Nicolescu 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'"
> > This doesn't take into consideration what exec bits changed while
> > changing the permissions assumming all (a). Is that intended?
> Yes, it is intended. Git only tracks the executable bit of the owner. If
> let's say you change a file permission from 644 to 744 (adding execute
> permission for the owner), git will track it as 755.
> Because this change shows the difference between the original tar and the
> git repo, it makes sense to use chmod +x/-x for all.
> I hope this makes sense.

That makes sense. Acked.

Acked-by: Andrei Gherzan <andrei.gherzan at canonical.com>

-- 
Andrei Gherzan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230411/5055a605/attachment.sig>


More information about the kernel-team mailing list