With a kernel tree that contains a generated include/linux/version.h, if
someone just does a git pull to update to a newer kernel version that
"UAPI: Plumb the UAPI Kbuilds into the user header installation and
"UAPI: Move linux/version.h"
Any newer build will fail to overwrite or remove the stale version.h
file. The new include/generated/uapi/linux/version.h is indeed
generated, but the stale file in include/linux has precedence.
This leads to very unfortunate consequences for any user relying on
version.h to expose the kernel version accurately, since the old "stale"
kernel version will be seen by the build.
Sadly, make clean does not even take care of removing this stale file.
I've had a couple of LTTng users, myself included, running into this
issue. In our case, it typically just causes a build failure, but I
suspect it may break build of other projects relying on version.h in
much more subtle ways.
Mathieu Desnoyers <[email protected]> wrote:
> This leads to very unfortunate consequences for any user relying on
> version.h to expose the kernel version accurately, since the old "stale"
> kernel version will be seen by the build.
> Sadly, make clean does not even take care of removing this stale file.
I wonder if a simple approach would work - just add:
$(shell rm include/linux/version.h)
to an appropriate header, perhaps the top-level Makefile.
Failing that, it might be worth adding it to the make-clean list.