Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Aug 2022 23:09:01 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 36d67475f549 - main - xinstall: fix dounpriv logic, add tests
Message-ID:  <86bkt13uhe.fsf@ltc.des.no>
In-Reply-To: <87AA26D1-D894-4779-B965-ECD53C581516@freebsd.org> (Jessica Clarke's message of "Wed, 3 Aug 2022 14:59:15 -0600")
References:  <202208031904.273J4SuL021844@gitrepo.freebsd.org> <87AA26D1-D894-4779-B965-ECD53C581516@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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=E2=80=
=99t
> believe technically matter, even if poor practice and not intended.

Take a closer look here:

>> -	if (!dounpriv &=20
>> -	    (gid !=3D (gid_t)-1 && gid !=3D to_sb.st_gid) ||
>> -	    (uid !=3D (uid_t)-1 && uid !=3D to_sb.st_uid))
>> +	if (!dounpriv && ((gid !=3D (gid_t)-1 && gid !=3D to_sb.st_gid) ||
>> +	    (uid !=3D (uid_t)-1 && uid !=3D 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
--=20
Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86bkt13uhe.fsf>