diff mbox series

[2/3] depmod: fix precedence order

Message ID 20210119145238.12774-2-lucas.demarchi@intel.com (mailing list archive)
State New
Headers show
Series [1/3] libkmod: Fix documentation on config precedence order | expand

Commit Message

Lucas De Marchi Jan. 19, 2021, 2:52 p.m. UTC
Configuration in /etc should have higher prio than /run.
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(-)

Comments

Marco d'Itri Jan. 19, 2021, 3:34 p.m. UTC | #1
On Jan 19, Lucas De Marchi <lucas.demarchi@intel.com> wrote:

> Configuration in /etc should have higher prio than /run.
> 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.
I agree. But the order is documented in the man pages, so you should 
change it there as well.
Lucas De Marchi Jan. 19, 2021, 5:22 p.m. UTC | #2
On Tue, Jan 19, 2021 at 04:34:45PM +0100, Marco d'Itri wrote:
>On Jan 19, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>
>> Configuration in /etc should have higher prio than /run.
>> 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.
>I agree. But the order is documented in the man pages, so you should
>change it there as well.

that is what the first patch does.

thanks
Lucas De Marchi

>
>-- 
>ciao,
>Marco
Dmitry V. Levin Jan. 19, 2021, 6:31 p.m. UTC | #3
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?

> 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
>  };
Lucas De Marchi Jan. 19, 2021, 8:36 p.m. UTC | #4
On Tue, Jan 19, 2021 at 10:35 AM Dmitry V. Levin <ldv@altlinux.org> 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
diff mbox series

Patch

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
 };