Skip to content

call_hook: honor $STOP_ON_ERROR when an executed hook sets task_error#135

Open
peturingi wants to merge 1 commit intofaiproject:masterfrom
peturingi:fix-1121552-hook-task-error
Open

call_hook: honor $STOP_ON_ERROR when an executed hook sets task_error#135
peturingi wants to merge 1 commit intofaiproject:masterfrom
peturingi:fix-1121552-hook-task-error

Conversation

@peturingi
Copy link
Copy Markdown

Debian bug: https://bugs.debian.org/1121552

A hook that runs as a separate process (not a .sh sourced hook) executes in a subshell. If it calls task_error CODE 1 with CODE > $STOP_ON_ERROR, stop_fai_installation is invoked inside the subshell; in most environments die then only replaces the subshell (e.g. exec bash -i under nfsroot) or only affects the subshell's state, so the parent FAI process continues running subsequent tasks.

The fix re-reads $LOGDIR/task_error after an executed hook returns and calls stop_fai_installation from the parent shell if the threshold has been crossed. Sourced .sh hooks already run in the parent shell and need no change.

Copilot AI review requested due to automatic review settings April 20, 2026 19:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a failure mode where an executed (non-sourced) hook runs in a subshell and can’t reliably stop the parent FAI process when it triggers task_error above $STOP_ON_ERROR. The change makes the parent shell re-check the global task error state after an executed hook returns and stops the installation from the parent context when needed.

Changes:

  • After running an executed hook ($hook.$class), re-read $LOGDIR/task_error.
  • If the recorded error exceeds $STOP_ON_ERROR, call stop_fai_installation from the parent shell.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/subroutines Outdated
@peturingi peturingi force-pushed the fix-1121552-hook-task-error branch from 1875230 to b4676cb Compare April 20, 2026 20:06
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.

2 participants