summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Orgis2023-12-12 15:24:16 +0100
committerThomas Orgis2023-12-12 23:13:12 +0100
commit10bb64245696e506ce9155a787c4a4def64ac9ca (patch)
treead9ec1992c68e2b600a772f846cf3921d2dac898
parent881ee986688b73031aad8c47a90d30f00021786f (diff)
libdepengine: ignore pre_remove and post_remove failures for failure detectiondevel-sobukus-protection
The loop prevention hack guessed wrongly that a pre_remove failure is serious and hence caused lots of spells being dropped once e.g. grep was cast, which has a PRE_REMOVE that returns non-zero (something we could investigate). Sorcery ignores that return value also for post_remove, but the runtime mechanism still stores the failure reason. Maybe we should ignore that failure reason log altogether. But I think I had a reason including it. We need to rewrite this all ... This commit also makes the two messages different, adding 'subtly' for the cases where the spell didn't outright fail but still has a reason (conflicts is one remaining case which we might want to settle) and listing the found reasons. This mainly should aid debugging once we get rid of these cases. Either there is a failure or not, please.
-rwxr-xr-xvar/lib/sorcery/modules/libdepengine13
1 files changed, 8 insertions, 5 deletions
diff --git a/var/lib/sorcery/modules/libdepengine b/var/lib/sorcery/modules/libdepengine
index 486fb63c..70b38328 100755
--- a/var/lib/sorcery/modules/libdepengine
+++ b/var/lib/sorcery/modules/libdepengine
@@ -135,19 +135,22 @@ depengine_cast_engine() {
rc=$?
fi
+ # pre_sub_depends failure is non-fatal, just means re-cast
+ # Also, pre_remove and post_remove return values are ignored, anyway.
+ local fail_reasons=$(grep -s "^$spell " "$CAST_BACKUPDIR/failure_reason_log" \
+ | cut -f 2 -d ' ' \
+ | grep -v -e '(pre_sub_depends)' -e '(pre_remove)' -e '(post_remove)')
# Crude hacks to avoid casting spells whose dependencies failed.
# Since sorcery does not properly keep track of spell state with
# its multiple passes, some grepping in files that store failures
# does the trick.
if grep -qs "^$spell$" "$FAILED_LIST"; then
message "${MESSAGE_COLOR}The spell ${SPELL_COLOR}$spell$MESSAGE_COLOR" \
- " failed to cast. Remembering that.$DEFAULT_COLOR"
+ " failed to cast. Remembering that. ${fail_reasons}$DEFAULT_COLOR"
rc=1
- # pre_sub_depends failure is non-fatal, just means re-cast
- elif grep -s "^$spell " "$CAST_BACKUPDIR/failure_reason_log" \
- | grep -q -v pre_sub_depends; then
+ elif [[ -n $fail_reasons ]]; then
message "${MESSAGE_COLOR}The spell ${SPELL_COLOR}$spell$MESSAGE_COLOR" \
- " failed before cast. Remembering that.$DEFAULT_COLOR"
+ " subtly failed before cast. Remembering that. ${fail_reasons}$DEFAULT_COLOR"
rc=1
fi