[systemd-commits] 2 commits - src/login src/vconsole

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jun 19 08:29:29 PDT 2012


 src/login/logind-user.c       |    4 +---
 src/vconsole/vconsole-setup.c |   24 +++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 2138e96918c7ed6fbf31f5df509f337a1973dfdd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jun 19 17:25:28 2012 +0200

    login: initialize XDG_RUNTIME_DIR as /run/user/$UID instead of /run/user/$USER
    
    The sssd folks would like to place the kerberos credential cache in
    XDG_RUNTIME_DIR, but need to do that in the PAM auth hooks, before
    pam_systemd is run as part of the PAM session setup. Hence, in order to
    make this easy for them: avoid usage of usernames, and use user IDs
    instead thus making an additional NSS lookup unnecessary in the kerberos
    bits, but still have the directory well-defined so that the kerberos
    bits can determine it before pam_systemd is run.

diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 4622812..0a3f22c 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -259,9 +259,7 @@ static int user_mkdir_runtime_path(User *u) {
         }
 
         if (!u->runtime_path) {
-                p = strappend("/run/user/", u->name);
-
-                if (!p) {
+                if (asprintf(&p, "/run/user/%lu", (unsigned long) u->uid) < 0) {
                         log_error("Out of memory");
                         return -ENOMEM;
                 }

commit d305a67b46644d6360ef557109384c831ee8e018
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Jun 10 20:37:14 2012 +0200

    vconsole-setup: enable utf-8 mode explicitly
    
    Rather than assuming the console is in utf-8 mode if nothing else is
    specified, be a bit more robust and enable it explicitly.
    
    This fixes a regression compared with Arch's initscripts when not
    using a framebuffer as the old VGA console would not be in utf-8
    mode by default.
    
    Furthermore, this would allow vconsole-setup to be used after boot
    to change the vconsole into utf-8 mode in case it has been set to
    non-utf-8 mode for whatever reason. I.e, the following would leave
    the console in utf-8 mode as expected:
    
     # export LANG=en_US.ISO-8859-1
     # /usr/lib/systemd/systemd-vconsole-setup
     # export LANG=en_US.UTF-8
     # /usr/lib/systemd/systemd-vconsole-setup
    
    Reported-by: Xyne <xyne at archlinx.ca>
    Reported-by: Thomas Bächler <thomas at archlinux.org>
    Cc: Dave Reisner <dreisner at archlinux.org>

diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index d04fab4..aa5fa18 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -80,6 +80,25 @@ static int disable_utf8(int fd) {
         return r;
 }
 
+static int enable_utf8(int fd) {
+        int r = 0, k;
+
+        if (ioctl(fd, KDSKBMODE, K_UNICODE) < 0)
+                r = -errno;
+
+        if (loop_write(fd, "\033%G", 3, false) < 0)
+                r = -errno;
+
+        k = write_one_line_file("/sys/module/vt/parameters/default_utf8", "1");
+        if (k < 0)
+                r = k;
+
+        if (r < 0)
+                log_warning("Failed to enable UTF-8: %s", strerror(-r));
+
+        return r;
+}
+
 static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
         const char *args[8];
         int i = 0;
@@ -418,9 +437,12 @@ int main(int argc, char **argv) {
 
         r = EXIT_FAILURE;
 
-        if (!utf8)
+        if (utf8)
+                enable_utf8(fd);
+        else
                 disable_utf8(fd);
 
+
         if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
             load_font(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
                 r = EXIT_SUCCESS;



More information about the systemd-commits mailing list