Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 286145 - linux-info.eclass: fix KV_OUT_DIR value under common circumstances
Summary: linux-info.eclass: fix KV_OUT_DIR value under common circumstances
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Kernel Miscellaneous
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-23 20:36 UTC by Fabio Erculiani (RETIRED)
Modified: 2010-01-10 09:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Erculiani (RETIRED) gentoo-dev 2009-09-23 20:36:50 UTC
It happens that users compile external Linux kernel modules for kernels that are not currently running on the system.
This causes KV_OUT_DIR variable to not be properly set in get_version() declared inside linux-info.eclass.
There is an incorrect check at line 498 that says:

[ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}" == "$(uname -r)" ] && \
     OUTPUT_DIR="..." (which is going to be used to setup KV_OUT_DIR)

It's clear that $(uname -r) returns kernel release for the _running_ kernel, which results in two main, issues:

1. KV_OUT_DIR is thus set to /usr/src/linux instead of /lib/modules/<version>/build (which is the proper way)
2. KV_OUT_DIR set to /usr/src/linux causes pkg_setup to fail when using binpkgs (emerge -B on PC1 && emerge -K on PC2). KV_OUT_DIR should be ALWAYS set to the most reliable path (/usr/src/linux is too generic).

Removing the conditional at line 498 seems to solve the issues without any regressions (here). Fact is, using `uname -r` is NOT really something that should be used there.

So, patch would be very easy, as in rip off this line completely:
"[ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}" == "$(uname -r)" ] && \"



Reproducible: Always
Comment 1 Fabio Erculiani (RETIRED) gentoo-dev 2009-09-24 18:11:58 UTC
Moreover, having a wrongly set KV_OUT_DIR (== /usr/src/linux) causes depmod to not be properly run for the "selected" kernel if such variable points to an invalid location.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-01-10 09:26:21 UTC
Committed in rev 1.81 now.