<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - logind: Save the user’s state when a session enters SESSION_ACTIVE"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90818">90818</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>logind: Save the user’s state when a session enters SESSION_ACTIVE
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bugzilla@tecnocode.co.uk
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>Patch coming to fix login’s STATE tracking for users to be correct when
starting a new session on a VT switch. This is important for PolicyKit
decisions about whether the user is active or online, as it affects the return
value of sd_uid_get_state().
See the commit message for full details.
See also: <a class="bz_bug_link
bz_status_NEW "
title="NEW - user_elect_display() overwrites DISPLAY with TTY session when switching VT away from a graphical session"
href="show_bug.cgi?id=90769">bug #90769</a>, <a class="bz_bug_link
bz_status_NEW "
title="NEW - allow_active/inactive match against the active session not the active user"
href="show_bug.cgi?id=67728">bug #67728</a>, <a class="bz_bug_link
bz_status_NEW "
title="NEW - Please use sd_uid_get_state() to make security decisions, not sd_pid_get_session()"
href="show_bug.cgi?id=76358">bug #76358</a>.
---
The incorrect behaviour can be tested by:
1. In an X11 terminal, `cat /run/systemd/users/$uid` gives SESSIONS=1
STATE=active.
2. Switch VT, log in, `cat /run/systemd/users/$uid` gives SESSIONS="c2 1"
STATE=online.
3. Switch back to X11 and cat again, gives SESSIONS="c2 1" STATE=active.
4. Switch back to VT and cat again, gives SESSIONS="c2 1" STATE=active.
With some debugging logging added to logind, it seems that when switching to
the VT (step #2 above):
A. Session 1 is switched from SESSION_ACTIVE to SESSION_ONLINE because of the
VT change.
B. A new session (c2) is created, with initial state SESSION_OPENING.
C. user_save() is called, which takes the maximum state of sessions 1 and c2,
which is SESSION_ONLINE.
D. user_save() is not called again after session c2 switches from
SESSION_OPENING to SESSION_ACTIVE.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>