chiark / gitweb /
vconsole-setup: fix vconsole.conf vs. cmdline overriding logic
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 5 Apr 2013 11:32:34 +0000 (13:32 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Fri, 5 Apr 2013 11:46:47 +0000 (13:46 +0200)
Skipping the parsing of /etc/vconsole.conf just because some values were
already assigned from the cmdline never made sense. And by the way, commit
f73141d changed the return values of parse_env_file() - it now gives 0
on success. Which means in current HEAD /etc/vconsole.conf overrides the
cmdline, which is the reverse of what's expected.

We need to parse /etc/vconsole.conf first and then let vconsole.*
overrides from cmdline take effect. The behaviour is documented in
vconsole.conf(5).

https://bugzilla.redhat.com/show_bug.cgi?id=948750

src/vconsole/vconsole-setup.c

index 84d7c5cba223d50ef2d5e398a4f1aae1e8537707..efeae909d9dede83fda56ef48349fbd21accbfdc 100644 (file)
@@ -254,8 +254,18 @@ int main(int argc, char **argv) {
 
         utf8 = is_locale_utf8();
 
 
         utf8 = is_locale_utf8();
 
-        r = 0;
-
+        r = parse_env_file("/etc/vconsole.conf", NEWLINE,
+                           "KEYMAP", &vc_keymap,
+                           "KEYMAP_TOGGLE", &vc_keymap_toggle,
+                           "FONT", &vc_font,
+                           "FONT_MAP", &vc_font_map,
+                           "FONT_UNIMAP", &vc_font_unimap,
+                           NULL);
+
+        if (r < 0 && r != -ENOENT)
+                log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
+
+        /* Let the kernel command line override /etc/vconsole.conf */
         if (detect_container(NULL) <= 0) {
                 r = parse_env_file("/proc/cmdline", WHITESPACE,
                                    "vconsole.keymap", &vc_keymap,
         if (detect_container(NULL) <= 0) {
                 r = parse_env_file("/proc/cmdline", WHITESPACE,
                                    "vconsole.keymap", &vc_keymap,
@@ -269,21 +279,6 @@ int main(int argc, char **argv) {
                         log_warning("Failed to read /proc/cmdline: %s", strerror(-r));
         }
 
                         log_warning("Failed to read /proc/cmdline: %s", strerror(-r));
         }
 
-        /* Hmm, nothing set on the kernel cmd line? Then let's
-         * try /etc/vconsole.conf */
-        if (r <= 0) {
-                r = parse_env_file("/etc/vconsole.conf", NEWLINE,
-                                   "KEYMAP", &vc_keymap,
-                                   "KEYMAP_TOGGLE", &vc_keymap_toggle,
-                                   "FONT", &vc_font,
-                                   "FONT_MAP", &vc_font_map,
-                                   "FONT_UNIMAP", &vc_font_unimap,
-                                   NULL);
-
-                if (r < 0 && r != -ENOENT)
-                        log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
-        }
-
         if (utf8)
                 enable_utf8(fd);
         else
         if (utf8)
                 enable_utf8(fd);
         else