Comment 7 for bug 1380364

Robert Ancell (robert-ancell) wrote :

I'm really struggling to find the correct behaviour here. What I know:
- man utmp shows:
char ut_line[UT_LINESIZE]; /* Device name of tty - "/dev/" */
- GDM 2.20 only put the tty into this field
- GDM git does:
         * Set ut_line to the device name associated with this display
         * but remove the "/dev/" prefix. If no device, then use the
         * $DISPLAY value.
        if (display_device != NULL
            && g_str_has_prefix (display_device, "/dev/")) {
                strncpy (u->ut_line,
                         display_device + strlen ("/dev/"),
                         sizeof (u->ut_line));
        } else if (x11_display_name != NULL) {
                strncpy (u->ut_line,
                         sizeof (u->ut_line));
- 'w' (the version in procps anyway) does:
                if (*u->ut_line == ':')
                        /* idle unknown for xdm logins */
                        printf(" ?xdm? ");
- xdm (1.1.11) doesn't set ut_line at all.
- AccountsService only stores ut_line and ut_tv (the timestamp) as a login record.
- gnome-control-center checks the history via AccountsService and checks if ut_line has the prefix ":" or "tty"

So while this clearly wasn't intended when utmp/wtmp was designed it seems everyone is using ut_line with ttyN for text logins and :n for X logins. That suggests we should revert the patch in LightDM.

I haven't been able to get GDM to work on my machine, can someone confirm the output of w in a modern GDM?