# Re: \[PATCH 2/3\] depmod: fix precedence order

- From: Lucas De Marchi \<hidden\>
- Date: 2021-01-19 20:39:22 
- List: linux-modules
- Page: https://ratatoskr.run/linux-modules/2021/01/16302861
- Thread: https://ratatoskr.run/linux-modules/2021/01/16302858/t.md

```text
On Tue, Jan 19, 2021 at 10:35 AM Dmitry V. Levin [ref] wrote:
>
> On Tue, Jan 19, 2021 at 06:52:37AM -0800, Lucas De Marchi wrote:
> > Configuration in /etc should have higher prio than /run.
>
> Should it?  Isn't the common practice nowadays to have /run override /etc?

Doesn't make much sense as /run can be derived from /usr/lib. /etc is
what the system
administrator touches and should have the final say.

Man pages from systemd agree with this logic:

    <title>Configuration Directories and Precedence</title>

    <para>Configuration files are read from directories in
<filename>/etc/</filename>,
    <filename>/run/</filename>, <filename>/usr/local/lib/</filename>,
and <filename>/usr/lib/</filename>, in
    order of precedence, as listed in the SYNOPSIS section above.
Files must have the the
    <literal>.conf</literal> extension. Files in
<filename>/etc/</filename> override files with the same name
    in <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and
    <filename>/usr/lib/</filename>. Files in
<filename>/run/</filename> override files with the same name
    under <filename>/usr/</filename>.</para>

Lucas De Marchi

>
> > Given how rarely configuration in /run is used with depmod, this is
> > likely not to cause any problems, even if it's a change in behavior.
> > ---
> >  tools/depmod.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/depmod.c b/tools/depmod.c
> > index 3f31cdf..8e1d9ec 100644
> > --- a/tools/depmod.c
> > +++ b/tools/depmod.c
> > @@ -51,8 +51,8 @@ static int verbose = DEFAULT_VERBOSE;
> >  static const char CFG_BUILTIN_KEY[] = "built-in";
> >  static const char CFG_EXTERNAL_KEY[] = "external";
> >  static const char *default_cfg_paths[] = {
> > -     "/run/depmod.d",
> >       SYSCONFDIR "/depmod.d",
> > +     "/run/depmod.d",
> >       "/lib/depmod.d",
> >       NULL
> >  };
>
> --
> ldv
```
