walters / rpms / plymouth

Forked from rpms/plymouth 6 years ago
Clone
Blob Blame History Raw
From 1445b5a6bfb87957a918b69dca94a62d4a36af7a Mon Sep 17 00:00:00 2001
From: "Dr. Tilmann Bubeck" <t.bubeck@reinform.de>
Date: Wed, 2 May 2012 18:18:13 +0200
Subject: [PATCH] two-step: quit properly when boot finishes while waiting for
 password

When the computer is progressing through its boot up process, plymouth
calls into the splash plugin's on_boot_progress function at regular
intervals with increasing values for "percent_done".  At some point, it
gets to 90% done, and that's when two-step begins its finishing
animation sequence.  As soon as this sequence finishes, two-step pulls
its stop trigger, which

1) sets its "is_idle" flag to true and
2) pulls the core plymouthd code's idle trigger, to notify that
   code that it's at a good animation frame to quit (if the core
   plymouthd code has an idle trigger set up)

During the boot process, the user may need to enter a password
(the "plymouth ask-for-password" command).  When that happens,
the splash waits for the user to enter a password, but boot progresses
in the background.

If the user then enters a password, the boot animation restarts again
(from the display_normal function).  This restarting of the boot
animation will cause the "is_idle" flag of the splash to get set back
to false.

Later when plymouthd wants to quit, it calls the become_idle function
of the splash plugin. That function notices "is_idle" is false, and
the stop_trigger is not NULL.  The function isn't suited to work
with this combination, and so at this point the splash never
tells the code daemon code it's idle.

This commit changes on_boot_progress to return before looking at
percent_done, if the user is getting asked a question.  This way
the stop_trigger won't get created prematurely, and is_idle won't
get out of sync.

https://bugs.freedesktop.org/show_bug.cgi?id=49355
---
 src/plugins/splash/two-step/plugin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
index 8f69e0f..1e6a7d0 100644
--- a/src/plugins/splash/two-step/plugin.c
+++ b/src/plugins/splash/two-step/plugin.c
@@ -1077,7 +1077,8 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin,
                   double                    duration,
                   double                    percent_done)
 {
-
+  if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+    return;
 
   if (percent_done >= SHOW_ANIMATION_PERCENT)
     {
-- 
1.7.12