Subject: Re: bug#48984: [PATCH] gnu: ddcutil: Patch kernel modules paths.

From: Brice Waegeneire <[email-masked]>
Date: Sun, 13 Jun 2021 15:07:01 +0200

Tobias,

Thank you for the review!

Tobias Geerinckx-Rice <[email-masked]> writes:
> Thanks for the patch!  Does it affect more than ‘ddcutil
> detect/environment’?  Anything ‘real’?

AFAIK no, this patch only get rid off that error message.

> Working around one of many bugs in a broken diagnostic subtool isn't worth
> maintaining a 32-line patch.

Fair enough, it's just a stop gap until 1.1.1 is released tho.

> Brice Waegeneire 写道：
>> Without it "ddcutil detect" complain: “Module i2c-dev is not loaded and
>> ddcutil can't determine if it is built into the kernel”.
>
> With it, it still complains:
>
>  ~ λ ddcutil detect
>  Module i2c-dev is not loaded and not built into the kernel.
>  ddcutil requires module i2c-dev

It's not the same error.

> It doesn't address the built-in case either, AFAICS.

I wasn't clear enough in the git message.  Here is the output wihtout
that patch and with it:

--8<---------------cut here---------------start------------->8---
$ modinfo i2c-dev | grep '^filename:'
filename:       (builtin)

$ guix environment --ad-hoc ddcutil -- ddcutil detect
Unable to read modules.builtin
Module i2c-dev is not loaded and ddcutil can't determine if it is built into the kernel
Display 1
[...]
$ ./pre-inst-env guix environment --ad-hoc ddcutil -- ddcutil detect
Display 1
[...]
--8<---------------cut here---------------end--------------->8--

With a built-in i2c-dev module, this patch remove that pesky error
message.

> The very idea of ddcutil's linux_util.c is flawed and can't be fixed: you
> don't look in /etc for the running kernel version; you don't use that
> ill-gotten string to start scanning random system directories for .ko
> files; you don't check for built-in modules by looking for possibly
> installed build leftovers.  None of that makes sense.  You ask kmod.  You
> ask the kernel!

I agreed it is flawed, but it was fixed by upstream in the 1.1.1-dev
branch¹ by using libkmod as you are suggesting.  I proposed that solution
to upstream some days ago in inssue #178²; he implementeded right away.

Since it's a development branch I tought it wasn't wise to update the
package to the latest commit.  Maybe you would you prefer such patch
instead?

¹ https://github.com/rockowitz/ddcutil/tree/1.1.1-dev
² https://github.com/rockowitz/ddcutil/issues/178#issuecomment-856297112

Cheers,
- Brice