Merge lp:~mterry/ubuntu-system-settings/wizard-double-finish into lp:ubuntu-system-settings/rtm-14.09

Proposed by Michael Terry
Status: Merged
Approved by: Ken VanDine
Approved revision: 975
Merged at revision: 1002
Proposed branch: lp:~mterry/ubuntu-system-settings/wizard-double-finish
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 11 lines (+2/-0)
1 file modified
wizard/qml/main.qml (+2/-0)
To merge this branch: bzr merge lp:~mterry/ubuntu-system-settings/wizard-double-finish
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+247908@code.launchpad.net

Commit message

Don't accept multiple "Finish" clicks during the last step of the wizard; doing so can cause password-setting to be left in an inconsistent state.

Description of the change

Don't accept multiple "Finish" clicks during the last step of the wizard; doing so can cause password-setting to be left in an inconsistent state.

Here's how that happens:

A) User clicks Finish multiple times, queuing up multiple input events (queued because Finish makes some blocking calls).
B) The first Finish starts, let's say it's called with new password "1111" and type "passcode". The current password is "" with a type of "swipe".
C) The first Finish completes, having set the password correctly to 1111/passcode.
D) The second Finish starts. Also called with "1111/passcode". But it still thinks the current type is "swipe" because it takes a moment for AccountsService to update itself.
E) The second Finish first changes the display mode hint to "passcode"
F) Then the second Finish can't change the password because it's trying to authenticate using "" when the password is actually "1111" now.
G) So the second Finish enters the "error mode cleanup" stage and tries to revert its display mode hint change from step E. But it's reverting to what it thought the previous type was -- "swipe" -- which uses the "passphrase" hint behind the scenes (instead of "passcode")

Note that this doesn't *always* happen. In between the first and second Finish operations, wizard cleanup starts, and the wizard may be killed during step F, which means we end up with the right state. But it's a race.

Some possible solutions to this:
- Cache the password type locally instead of waiting for AccountsService to update (not a bad idea, I'm not sure whether that's desirable or not -- I originally did it this way thinking local state might get out of sync, but not apparently it's remote state that's out of sync)
- Don't let the user click the Finish button twice. This seems like a no-brainer that should be done anyway. This would also avoid the whole problem.

I think for RTM, just the latter fix is enough. (I have separately filed a unity8 branch to do the latter fix in vivid's welcome wizard.) For trunk, I'd entertain also locally caching the password type if you want me to.

To reproduce this bug / test this fix, enable the wizard, enter adb, run "sudo passwd -d phablet", reboot, then go through the wizard but just keep spamming that final Finish button. You'll also notice some slow down because it's trying to do all those Finish operations.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wizard/qml/main.qml'
2--- wizard/qml/main.qml 2014-10-31 14:20:14 +0000
3+++ wizard/qml/main.qml 2015-01-28 22:19:27 +0000
4@@ -48,6 +48,8 @@
5 }
6
7 function quitWizard() {
8+ pageStack.currentPage.enabled = false
9+
10 // Immediately go to black to give quick feedback
11 blackCover.visible = true
12

Subscribers

People subscribed via source and target branches