Skip to content

Fix race condition in email output generation - #290

Draft
Shotte wants to merge 1 commit into
BassT23:masterfrom
Shotte:fix/email-output-race-condition
Draft

Fix race condition in email output generation#290
Shotte wants to merge 1 commit into
BassT23:masterfrom
Shotte:fix/email-output-race-condition

Conversation

@Shotte

@Shotte Shotte commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Fixes a race condition in the email output generation of check-updates.sh.

The update check output is written through asynchronous tee process substitutions. The EXIT trap may inspect and send mail-output before these processes have finished writing, resulting in empty or incomplete email notifications.

Changes

  • Store the complete check result in check-output through one tee process.
  • Preserve and restore the original stdout.
  • Wait for the output process to finish before generating the email.
  • Build mail-output synchronously from the completed check-output.
  • Send the no-updates notification to the configured EMAIL_USER.

Validation

Tested on:

  • Proxmox VE 9.2
  • pve-manager 9.2.5
  • Ultimate Updater Check 1.7.9

Before the change:

check-output: 196 bytes
mail-output: 0 bytes

After the change:

check-output: 196 bytes
mail-output: 140 bytes

The generated email contained the complete update summary after the change.

Validation performed:

bash -n check-updates.sh

The syntax check completed successfully.

Fixes #289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email output can be empty because EXIT trap does not wait for tee process

1 participant