Comment 13 for bug 1621824

Revision history for this message
Steve Langasek (vorlon) wrote :

Thanks, this strace shows that src/getfd.c:getfd_keymap() is unable to find any VTs not in raw mode:

int
getfd_keymap(void) {
        int fd, bestfd = -1;
        char ttyname[sizeof("/dev/ttyNN")] = "/dev/tty";
        int i;

#define CHECK_FD_KEYMAP do { \
        if (is_a_console(fd)) { \
                long mode = kbmode(fd); \
                if (mode == K_UNICODE) { \
                        if (bestfd != -1) \
                                close(bestfd); \
                        return fd; \
                } else if (mode == K_XLATE && bestfd == -1) \
                        bestfd = fd; \
                else \
                        close(fd); \
        } else \
                close(fd); \
} while (0)

[...]

        for (i = 1; i <= 12; ++i) {
                snprintf(ttyname + sizeof("/dev/tty") - 1, 3, "%d", i);
                if ((fd = open_a_console(ttyname)) >= 0)
                        CHECK_FD_KEYMAP;
        }

        fprintf(stderr,
                _("Couldn't get a file descriptor referring to the console\n"));

        /* total failure */
        exit(1);
}

is_a_console() checks KDGKBTYPE, kbmode() checks KDGKBMODE.

Could you please compile and run the attached program as root on the affected system, and post the results?

In the course of investigating, I've discovered locally that ioctl(fd, KDGKBMODE), despite taking an unsigned long * as an argument, doesn't fully clear the address here on xenial x86_64. So if this program returns sensible results on your system, we may be looking at a memory initialization bug.