chiark / gitweb /
rules sort order: /lib, /run, /etc
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 14 Mar 2012 13:52:45 +0000 (14:52 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 14 Mar 2012 17:10:59 +0000 (18:10 +0100)
After long consideration we came to the conclusion that user
configuration in /etc should always override the (generally
computer generated) configuration in /run. User configuration
should always be what matters over anything else. Hence rearrange
the search orders accordingly. In general this should change
very little as overriding like this is seldomn done so far,
and the order between /etc and /usr stays the same.

NEWS
src/libudev.c
src/udev-rules.c
src/udev.xml

diff --git a/NEWS b/NEWS
index 00ee648ca3f3e461fd6bf41481b0ccc030ab120b..b19cf7b5080ea251f3b1a858699960762b678acd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ The udev-acl tool is no longer provided, it will be part of a future
 ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl
 functionality are provided by systemd.
 
 ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl
 functionality are provided by systemd.
 
+Rules files in /etc/udev/rules.s/ with the same name as rules files in
+/run/udev/rules.d/ now always have precedence. The stack of files is now:
+/usr/lib (package), /run (runtime, auto-generated), /etc (admin), while
+the later ones override the earlier ones. In other words: the admin has
+always the last say.
+
 
 udev 181
 ========
 
 udev 181
 ========
index be24329adc85b2edb858fd0b0b2bb0e1acd7b80a..d954daef68dd674ec567efd14198593a5de362f4 100644 (file)
@@ -236,7 +236,7 @@ UDEV_EXPORT struct udev *udev_new(void)
                 fclose(f);
         }
 
                 fclose(f);
         }
 
-        /* environment overwrites config */
+        /* environment overrides config */
         env = getenv("UDEV_LOG");
         if (env != NULL)
                 udev_set_log_priority(udev, util_log_priority(env));
         env = getenv("UDEV_LOG");
         if (env != NULL)
                 udev_set_log_priority(udev, util_log_priority(env));
@@ -260,15 +260,15 @@ UDEV_EXPORT struct udev *udev_new(void)
                 if (!udev->rules_path[0])
                         goto err;
 
                 if (!udev->rules_path[0])
                         goto err;
 
+                /* /run/udev -- runtime rules */
+                if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
+                        goto err;
+
                 /* /etc/udev -- local administration rules */
                 udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
                 if (!udev->rules_path[1])
                         goto err;
 
                 /* /etc/udev -- local administration rules */
                 udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
                 if (!udev->rules_path[1])
                         goto err;
 
-                /* /run/udev -- runtime rules */
-                if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
-                        goto err;
-
                 udev->rules_path_count = 3;
         }
 
                 udev->rules_path_count = 3;
         }
 
index a5b4b7306affd07bca819add89adddd8ff05c0ca..8a85eae717339a5a46eb9f901dbc949d1c7dd560 100644 (file)
@@ -1737,7 +1737,7 @@ static int add_matching_files(struct udev *udev, struct udev_list *file_list, co
                 dbg(udev, "put file '%s' into list\n", filename);
                 /*
                  * the basename is the key, the filename the value
                 dbg(udev, "put file '%s' into list\n", filename);
                 /*
                  * the basename is the key, the filename the value
-                 * identical basenames from different directories overwrite each other
+                 * identical basenames from different directories override each other
                  * entries are sorted after basename
                  */
                 udev_list_entry_add(file_list, dent->d_name, filename);
                  * entries are sorted after basename
                  */
                 udev_list_entry_add(file_list, dent->d_name, filename);
index 4de434ee514df311bbba057d68d61c7d075e3835..8eb583a823cfb40465ad2720227a60159d3d8a61 100644 (file)
     <refsect2><title>Rules files</title>
       <para>The udev rules are read from the files located in the
       system rules directory <filename>/usr/lib/udev/rules.d</filename>,
     <refsect2><title>Rules files</title>
       <para>The udev rules are read from the files located in the
       system rules directory <filename>/usr/lib/udev/rules.d</filename>,
-      the local administration directory <filename>/etc/udev/rules.d</filename>
-      and the volatile runtime directory <filename>/run/udev/rules.d</filename>.
+      the volatile runtime directory <filename>/run/udev/rules.d</filename>
+      and the local administration directory <filename>/etc/udev/rules.d</filename>.
       All rules files are collectively sorted and processed in lexical order,
       regardless of the directories in which they live. However, files with
       All rules files are collectively sorted and processed in lexical order,
       regardless of the directories in which they live. However, files with
-      identical file names replace each other. Files in <filename>/run</filename>
-      have the highest priority, files in <filename>/etc</filename> take precedence
+      identical file names replace each other. Files in <filename>/etc</filename>
+      have the highest priority, files in <filename>/run</filename> take precedence
       over files with the same name in <filename>/lib</filename>. This can be
       over files with the same name in <filename>/lib</filename>. This can be
-      used to overwrite a system rules file if needed; a symlink in
-      <filename>/etc</filename> with the same name as a rules file in
+      used to override a system-supplied rules file with a local file if needed;
+      a symlink in <filename>/etc</filename> with the same name as a rules file in
       <filename>/lib</filename>, pointing to <filename>/dev/null</filename>,
       disables the rules file entirely.</para>
 
       <filename>/lib</filename>, pointing to <filename>/dev/null</filename>,
       disables the rules file entirely.</para>
 
         <varlistentry>
           <term><option>OWNER, GROUP, MODE</option></term>
           <listitem>
         <varlistentry>
           <term><option>OWNER, GROUP, MODE</option></term>
           <listitem>
-            <para>The permissions for the device node. Every specified value overwrites
+            <para>The permissions for the device node. Every specified value overrides
             the compiled-in default value.</para>
           </listitem>
         </varlistentry>
             the compiled-in default value.</para>
           </listitem>
         </varlistentry>