Re: git: 36d67475f549 - main - xinstall: fix dounpriv logic, add tests
- In reply to: Jessica Clarke : "Re: git: 36d67475f549 - main - xinstall: fix dounpriv logic, add tests"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 Aug 2022 21:09:01 UTC
Jessica Clarke <jrtc27@freebsd.org> writes:
> This is quite a poor commit message. What was wrong with it? Especially
> when the diff is cluttered with reformatting. I cannot obviously see
> any behavioural changes, just some changes from & to && that I don’t
> believe technically matter, even if poor practice and not intended.
Take a closer look here:
>> - if (!dounpriv &
>> - (gid != (gid_t)-1 && gid != to_sb.st_gid) ||
>> - (uid != (uid_t)-1 && uid != to_sb.st_uid))
>> + if (!dounpriv && ((gid != (gid_t)-1 && gid != to_sb.st_gid) ||
>> + (uid != (uid_t)-1 && uid != to_sb.st_uid))) {
The intended logic is:
if not unpriv and (need to set gid or need to set uid)
The actual logic is:
if (not unpriv and need to set gid) or need to set uid
Luckily it had no practical effect because uid and gid are always -1
when dounpriv is non-zero.
I pulled the gid line up to match the formatting of the previous
conditional, ten or so lines back.
DES
--
Dag-Erling Smørgrav - des@FreeBSD.org