Re: [PATCH 1/1] kernel-2.eclass: Check to ensure genpatches contains the intended linux patch version

Sam James <[email protected]>
Newsgroups gmane.linux.gentoo.devel
Organization Gentoo
Message-ID <[email protected]>
Sam James <[email protected]> writes:

> Mike Pagano <[email protected]> writes:
>
>> Iterate through the patch set files names looking for the kernel
>> version to be installed. Die on failure.
>>
>> Signed-off-by: Mike Pagano <[email protected]>
>
> I'd include two Bug tags for
> Bug: https://bugs.gentoo.org/972596
> and
> Bug: https://bugs.gentoo.org/970493
>
>> ---
>>  eclass/kernel-2.eclass | 22 ++++++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>
>> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
>> index 9484eab5b..7676e7276 100644
>> --- a/eclass/kernel-2.eclass
>> +++ b/eclass/kernel-2.eclass
>> @@ -1115,6 +1115,28 @@ unipatch() {
>>  			fi
>>  		fi
>>
>> +        # If we use genpatches, let's make sure it includes the
>> +        # kernel patch for the version we are trying to install
>> +        # This is a sanity check to make sure the genpatches version
>> +        # in the ebuild is correct
>> +        #
>> +        # Iterate through patch and look for OKV
>> +        if [[ -n "${K_WANT_GENPATCHES}" ]]; then
>> +            KV_PATCH_FOUND=
>> +            for file in ${KPATCH_DIR}/*; do
>> +                filename="${file##*/}"
>> +                if [[ "$filename" == *"${OKV}"* ]]; then
>> +                    KV_PATCH_FOUND=yes
>> +                    break;
>> +                fi
>> +            done
>> +            if [[ -z ${KV_PATCH_FOUND} ]]; then
>> +                eerror "GENPATCHES does not contain linux patch ${OKV}"
>> +                eerror "Please check your ebuild for the proper
>> K_GENPATCHES_VER=N"
>> +                die "GENPATCHES appears to be missing Linux patch ${OKV}"
>> +            fi
>> +        fi
>
> Not tested it but this looks reasonable to me, thank you!
>
> Another check could be done on VERSION/PATCHLEVEL in the Makefile to
> compare with PV but I am not sure that adds anything on top of this, and
> I think this check would catch the cases we've seen happen, so I
> wouldn't worry about that.

One thing I realised: the check as-written would allow downgrades,
e.g. 6.1.5 where the patches are actually for 6.1.10 because it contains
all the patches for PV, yet the final version in the Makefile wouldn't
match PV.

>
>> +
>>  		# If experimental was not chosen by the user, drop
>>                    experimental patches not in K_EXP_GENPATCHES_LIST.
>>  		if [[ ${i} == *genpatches-*.experimental.* && -n
>>  		${K_EXP_GENPATCHES_PULL} ]]; then
>>  			if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmn4ym0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkLxJ
AP9Zjc3A/kTwDRFLFiIGQyPDY/4Z24ugg3P8J1wLYBXkwwEA8CQ8PraP/rIUvmqr
RWoeYWTwfb4P8d6i2oZVef3BpQ0=
=Zfdj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.