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, x11_display_name, 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?
I'm really struggling to find the correct behaviour here. What I know: UT_LINESIZE] ; /* Device name of tty - "/dev/" */
strncpy (u->ut_line,
display_ device + strlen ("/dev/"),
sizeof (u->ut_line));
strncpy (u->ut_line,
x11_ display_ name,
sizeof (u->ut_line));
/* idle unknown for xdm logins */
printf( " ?xdm? "); center checks the history via AccountsService and checks if ut_line has the prefix ":" or "tty"
- man utmp shows:
char ut_line[
- 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/")) {
} else if (x11_display_name != NULL) {
}
- 'w' (the version in procps anyway) does:
if (*u->ut_line == ':')
- 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-
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?