kmod-project / kmod

kmod - Linux kernel module handling
GNU Lesser General Public License v2.1
50 stars 39 forks source link

Rethink and properly handle assert() #255

Open evelikov opened 6 days ago

evelikov commented 6 days ago

As inspired by https://github.com/kmod-project/kmod/pull/239#pullrequestreview-2440374673 and related reply, we currently have a handful of asserts across the code-base - libkmod, shared, testsuite, tools.

From a library POV asserts are not wanted, since it would lead to crashes. From a test POV, the crash (or crash-like) behaviour is exactly what we want. In addition meson (since v0.50 or thereabouts) sets -DNDEBUG for --buildtype=release, thus the asserts get removed.

Seemingly we have two conflicting needs... Ideally we'll nuke all the asserts and/or replace them with something more suitable. As an alternative we could build the assert containing code twice - normal + one for our code/test coverage (always undefine NDEBUG)

Rough list of ideas/tasks: