Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Thomas Orgis (1b679999e2cc426054e35a406367c455d519c985)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Thomas Orgis <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Thomas Orgis (1b679999e2cc426054e35a406367c455d519c985)
  • Date: Fri, 26 Feb 2021 10:36:11 +0000

GIT changes to master sorcery by Thomas Orgis <sobukus AT sourcemage.org>:

var/lib/sorcery/modules/libdepengine | 4 ++++
var/lib/sorcery/modules/libmisc | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 1b679999e2cc426054e35a406367c455d519c985
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>

libdepengine: more debugging

commit d4faf47101a6f1ee7c354813624968e3a6d671df
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>

libmisc: more robust debugging of parallel work

This prints out the whole debugging line on one go to reduce interference
of printouts from multiple sorcery processes (subshells for cast passes).
Debugging is a nightmare when data within a line is already interleaved!
This is still not proper, but we don't want to bring things to a crawl by
i/o locking. An alternative might be to write output to per-process files.
But then, we also should implement timestamps in the output. Pro-tip: use
ts from moreutils in a tail -f | ts configuration to put them on closely
after the fact.

Also, to actually tell the differing subshells of the cast process apart,
the variable $$ is not enough. Bash offers an alternative. This is used
with $$ as fallback now. We may want to check what to do for other shells
that we want to be able to run sorcery properly.

diff --git a/var/lib/sorcery/modules/libdepengine
b/var/lib/sorcery/modules/libdepengine
index 1ca39c5..8644ab5 100755
--- a/var/lib/sorcery/modules/libdepengine
+++ b/var/lib/sorcery/modules/libdepengine
@@ -153,6 +153,7 @@ depengine_cast_engine() {

dpgn_set_spell_color $spell black:$rc

+ debug "libdepengine" "done with depengine_cast_engine $@"
return $rc
}

@@ -231,6 +232,7 @@ recurse_depends() {
# catches those cases where we dont, and doesn't worry too much
# about a failure
if [[ $rc == 0 ]] ; then
+ debug "libdepengine" "build triggerers of $spell"
local hash_triggerers
hash_get_ref trg_r_hash $spell:cast_self hash_triggerers
for triggerer in $hash_triggerers; do
@@ -242,6 +244,7 @@ recurse_depends() {
fi
done
fi
+ debug "libdepengine" "done with recurse_depends $@"
return $rc
}

@@ -350,6 +353,7 @@ execute_triggers() {
## frontend to cast spells, unregisters pending triggers if any
#------------------------------------------------------------------------
dpgn_cast_spell_front() {
+ $STD_DEBUG
if ! [[ $CAST_PASS ]] ; then
message "ERROR: Missing cast pass variable!!"
exit 1
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 8eba985..b2bc2c0 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -230,12 +230,18 @@ debug() {
debugVar=${debugVar//[^a-zA-Z0-9_]/_}
local i
if [[ ${!debugVar} != "no" ]] ; then
- echo -n "$1($$): " >>$DEBUG
+ # Construct line and print out in one go, to lessen interference from
+ # parallel work, and some strange interference between printouts of one
+ # and the same process that I do not understand (yet, or ever).
+ # In ( ... ) subshells, $$ still refers to the mother shell, trying
+ # the bashism with fallback to be able to tell apart parallel cast passes
+ # three and four.
+ local line="$1(${BASHPID:-$$}):"
shift
for i in "$@" ; do
- echo -n " \"$i\"" >>$DEBUG
+ line="$line \"$i\""
done
- echo >>$DEBUG
+ printf "%s\n" "$line" >>$DEBUG
fi

true



  • [SM-Commit] GIT changes to master sorcery by Thomas Orgis (1b679999e2cc426054e35a406367c455d519c985), Thomas Orgis, 02/26/2021

Archive powered by MHonArc 2.6.24.

Top of Page