[v2] fix premature success dialog in installer script

Message ID 20250806055438.3318548-1-kasturi.shekar@siemens.com
State New
Headers show
Series [v2] fix premature success dialog in installer script | expand

Commit Message

Shekar, Kasturi Aug. 6, 2025, 5:54 a.m. UTC
The 'Installation successful' message was displayed before the
progress bar completed. Fixed by tracking the dialog --gauge PID
and terminating it after bmaptool finishes. This ensures
the progress bar runs to 100% before showing the final message.

Changes:
- Tracked the PID of the dialog --gauge process.
- Killed gauge process after bmaptool completed.
- Ensured success message is shown only after the progress bar ends.

Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
 .../deploy-image/files/usr/bin/deploy-image-wic.sh            | 4 ++++
 1 file changed, 4 insertions(+)

Comments

MOESSBAUER, Felix Aug. 6, 2025, 7:29 a.m. UTC | #1
On Wed, 2025-08-06 at 11:24 +0530, 'Kasturi Shekar' via isar-users
wrote:
> The 'Installation successful' message was displayed before the
> progress bar completed. Fixed by tracking the dialog --gauge PID
> and terminating it after bmaptool finishes. This ensures
> the progress bar runs to 100% before showing the final message.

Hi,

I'm still wondering how that could happen. The bmaptool is the command
that needs to terminate before showing the next message. How does the
killing of the gauge help here?

> 
> Changes:
> - Tracked the PID of the dialog --gauge process.
> - Killed gauge process after bmaptool completed.
> - Ensured success message is shown only after the progress bar ends.
> 
> Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
> ---
>  .../deploy-image/files/usr/bin/deploy-image-wic.sh            | 4
> ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/meta-isar/recipes-installer/deploy-
> image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> index aba81c84..fa1061c1 100755
> --- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> image-wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> image-wic.sh
> @@ -183,12 +183,16 @@ if version_ge "$bmap_version" "3.6"; then
>          done
>      ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
>  
> +    gauge_pid=$!
>  fi
>  
>  if ! bmaptool ${quiet_flag} copy ${bmap_options}
> "$installer_image_uri" "${installer_target_dev}"; then
> +    kill "$gauge_pid"
>      exit 1

As we exit anyways, why do we need to kill the gauge?
Isn't it reaped when leaving the script?

>  fi
>  
> +kill "$gauge_pid" 2>/dev/null

Why do we need to ignore errors here?

PS: This script could need some shellcheck improvements.

Felix

> +
>  if ! $installer_unattended; then
>      dialog --title "Reboot" \
>             --msgbox "Installation was successful. System will be
> rebooted. Please remove the USB stick." 6 60
> -- 
> 2.39.5
Shekar, Kasturi Aug. 6, 2025, 9:28 a.m. UTC | #2
Hi,

The gauge runs in a separate background process and reads from a named pipe.
Even after bmap tool finishes, the read loop can remain active, causing the gauge to overlap with the success dialog. Explicitly killing the gauge ensures it terminates cleanly before the next message is shown.

Thanks

> -----Original Message-----
> From: Moessbauer, Felix (FT RPD CED OES-DE)
> <felix.moessbauer@siemens.com>
> Sent: 06 August 2025 12:59
> To: Shekar, Kasturi (FT FDS CES LX PBU 2) <kasturi.shekar@siemens.com>;
> isar-users@googlegroups.com
> Subject: Re: [PATCH v2] fix premature success dialog in installer script
> 
> On Wed, 2025-08-06 at 11:24 +0530, 'Kasturi Shekar' via isar-users
> wrote:
> > The 'Installation successful' message was displayed before the
> > progress bar completed. Fixed by tracking the dialog --gauge PID and
> > terminating it after bmaptool finishes. This ensures the progress bar
> > runs to 100% before showing the final message.
> 
> Hi,
> 
> I'm still wondering how that could happen. The bmaptool is the command
> that needs to terminate before showing the next message. How does the
> killing of the gauge help here?
> 
> >
> > Changes:
> > - Tracked the PID of the dialog --gauge process.
> > - Killed gauge process after bmaptool completed.
> > - Ensured success message is shown only after the progress bar ends.
> >
> > Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
> > ---
> >  .../deploy-image/files/usr/bin/deploy-image-wic.sh            | 4
> > ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > index aba81c84..fa1061c1 100755
> > --- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> > image-wic.sh
> > +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> > image-wic.sh
> > @@ -183,12 +183,16 @@ if version_ge "$bmap_version" "3.6"; then
> >          done
> >      ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
> >
> > +    gauge_pid=$!
> >  fi
> >
> >  if ! bmaptool ${quiet_flag} copy ${bmap_options}
> > "$installer_image_uri" "${installer_target_dev}"; then
> > +    kill "$gauge_pid"
> >      exit 1
> 
> As we exit anyways, why do we need to kill the gauge?
> Isn't it reaped when leaving the script?
> 
> >  fi
> >
> > +kill "$gauge_pid" 2>/dev/null
> 
> Why do we need to ignore errors here?
> 
> PS: This script could need some shellcheck improvements.
> 
> Felix
> 
> > +
> >  if ! $installer_unattended; then
> >      dialog --title "Reboot" \
> >             --msgbox "Installation was successful. System will be
> > rebooted. Please remove the USB stick." 6 60
> > --
> > 2.39.5
> 
> --
> Siemens AG
> Linux Expert Center
> Friedrich-Ludwig-Bauer-Str. 3
> 85748 Garching, Germany
Shekar, Kasturi Aug. 6, 2025, 10:22 a.m. UTC | #3
`2>/dev/null` is just to suppress harmless kill errors on UI if the gauge wasn’t started or has already exited. Otherwise, users would see “No such process” messages during normal runs.

I agree that the script could benefit from some ShellCheck cleanups. I can work on running it through ShellCheck and submit a follow‑up patch.

Thanks,
Kasturi

> -----Original Message-----
> From: Moessbauer, Felix (FT RPD CED OES-DE)
> <felix.moessbauer@siemens.com>
> Sent: 06 August 2025 12:59
> To: Shekar, Kasturi (FT FDS CES LX PBU 2) <kasturi.shekar@siemens.com>;
> isar-users@googlegroups.com
> Subject: Re: [PATCH v2] fix premature success dialog in installer script
> 
> On Wed, 2025-08-06 at 11:24 +0530, 'Kasturi Shekar' via isar-users
> wrote:
> > The 'Installation successful' message was displayed before the
> > progress bar completed. Fixed by tracking the dialog --gauge PID and
> > terminating it after bmaptool finishes. This ensures the progress bar
> > runs to 100% before showing the final message.
> 
> Hi,
> 
> I'm still wondering how that could happen. The bmaptool is the command
> that needs to terminate before showing the next message. How does the
> killing of the gauge help here?
> 
> >
> > Changes:
> > - Tracked the PID of the dialog --gauge process.
> > - Killed gauge process after bmaptool completed.
> > - Ensured success message is shown only after the progress bar ends.
> >
> > Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
> > ---
> >  .../deploy-image/files/usr/bin/deploy-image-wic.sh            | 4
> > ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/meta-isar/recipes-installer/deploy-
> > image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-
> > installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> > index aba81c84..fa1061c1 100755
> > --- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> > image-wic.sh
> > +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-
> > image-wic.sh
> > @@ -183,12 +183,16 @@ if version_ge "$bmap_version" "3.6"; then
> >          done
> >      ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
> >
> > +    gauge_pid=$!
> >  fi
> >
> >  if ! bmaptool ${quiet_flag} copy ${bmap_options}
> > "$installer_image_uri" "${installer_target_dev}"; then
> > +    kill "$gauge_pid"
> >      exit 1
> 
> As we exit anyways, why do we need to kill the gauge?
> Isn't it reaped when leaving the script?
> 
> >  fi
> >
> > +kill "$gauge_pid" 2>/dev/null
> 
> Why do we need to ignore errors here?
> 
> PS: This script could need some shellcheck improvements.
> 
> Felix
> 
> > +
> >  if ! $installer_unattended; then
> >      dialog --title "Reboot" \
> >             --msgbox "Installation was successful. System will be
> > rebooted. Please remove the USB stick." 6 60
> > --
> > 2.39.5
> 
> --
> Siemens AG
> Linux Expert Center
> Friedrich-Ludwig-Bauer-Str. 3
> 85748 Garching, Germany

Patch

diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
index aba81c84..fa1061c1 100755
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
@@ -183,12 +183,16 @@  if version_ge "$bmap_version" "3.6"; then
         done
     ) | dialog --gauge "Flashing image, please wait..." 10 70 0 &
 
+    gauge_pid=$!
 fi
 
 if ! bmaptool ${quiet_flag} copy ${bmap_options} "$installer_image_uri" "${installer_target_dev}"; then
+    kill "$gauge_pid"
     exit 1
 fi
 
+kill "$gauge_pid" 2>/dev/null
+
 if ! $installer_unattended; then
     dialog --title "Reboot" \
            --msgbox "Installation was successful. System will be rebooted. Please remove the USB stick." 6 60