snap whoami does not reflect correct login status

Bug #1709807 reported by Kristin Chuang
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
Undecided
Maciej Borzecki

Bug Description

===== steps =====

[1a] Complete console-conf process during system setup stage using email account <email address hidden>

[1b] Check login status:
$ snap whoami
email: - #blank email info returned, should return foo's info

$ cat ~/.snap/auth.json
  #~/.snap/auth.json exists, but no explicit foo related info listed in content

[2a] Do login with a new account <email address hidden>
$ snap login <email address hidden>
<enter password>
Login successful

[2b] Check login status:
$ snap whoami
email: <email address hidden> #email info updated from blank to previous user foo, but should actually update to user bar

$ cat ~/.snap/auth.json
{"id":1,"username":"foo","email":"<email address hidden>"...} #content updated to user foo's info, but should actually be updated to user bar's

[3a] Logout:
$ snap logout

[3b] Check login status:
$ cat ~/.snap/auth.json
cat: .snap/auth.json: No such file or directory

[4a] Try logging in again with <email address hidden>
$ sudo snap login <email address hidden>
<enter password>
Login successful

[4b] Check login status:
$ snap whoami
email: <email address hidden> #correctly reflects current user

$ cat ~/.snap/auth.json
{"id":2,"email":"<email address hidden>"...} #correctly updated with current user's info

===== expected result =====
`snap whoami` and ~/.snap/auth.json should correctly reflect the status of the current user

===== actual result =====
1. Note the difference between step 2a and 4a, 1b and 3b:
 * ~/.snap/auth.json exists in 1b, while it does not in 3b.
 * Step in 2a does not need sudo, while step in 4a does.
This indicates that, if I am not mistaken, foo is already logged in after console-conf completed, but not reflected correctly in `snap whoami` or ~/.snap/auth.json.

2. Note steps 2a & 2b:
User has been updated from foo to bar in these steps, but `snap whoami` and ~/.snap/auth.json is one step behind and just updates from blank user to previous user foo.

3. Note steps 3a and after:
The current user info is logged correctly only after a `snap logout` has been performed to reset the authentication details.

=> As a conclusion:
It seems like the initial user info is already incorrect, and will not update to the correct status unless a reset-like function `snap logout` is performed.

===== Core version =====
$ snap list
Name Version Rev Developer Notes
core 16-2.26.9 2381 canonical -

description: updated
description: updated
Changed in snapd:
assignee: nobody → Maciej Borzecki (maciek-borzecki)
status: New → Confirmed
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

Thanks for reporting this. The fix for the empty email after console-conf just landed right here: https://github.com/snapcore/snapd/pull/4460

The second part, with email not getting update, should get resolved soon as well.

Changed in snapd:
status: Confirmed → In Progress
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

The second bit just landed right here: https://github.com/snapcore/snapd/pull/4463

Changed in snapd:
status: In Progress → Fix Committed
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.