Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Andrew Stitt (0e543c1622d437d7072e7cc2e0a749792ccc8d27)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Andrew Stitt <scm AT mail.sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Andrew Stitt (0e543c1622d437d7072e7cc2e0a749792ccc8d27)
  • Date: Sat, 25 Nov 2006 11:16:49 -0600

GIT changes to master sorcery by Andrew Stitt <astitt AT sourcemage.org>:

ChangeLog | 4 ++++
var/lib/sorcery/modules/libmisc | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 0e543c1622d437d7072e7cc2e0a749792ccc8d27
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

Re-arrange changelog entry

commit 4c9826286dfe566e108d242abe6bf1aa64213f5c
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

fix bug 13228, add locking in persistent_save and persistent_load

diff --git a/ChangeLog b/ChangeLog
index 32cefc2..6233c9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-25 Andrew Stitt <astitt AT sourcemage.org>
+ * libmisc: lock the persistent file on load and save it with
+ a transaction to prevent corruption from ctrl-c. Bug 13228
+
2006-11-17 Andrew Stitt <astitt AT sourcemage.org>
* libtrack, libapi: add a routine to record modified config files,
this is an alternative to running install_config_files
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 37c7064..a43f9c0 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -702,11 +702,13 @@ function real_persistent_remove () {
function real_persistent_load () {
local PERSISTENT_LOADING=yes
local PERSISTENT_FILE=${1:-$SPELL_CONFIG.p}
+ lock_file "$PERSISTENT_FILE"
if [ -f "$PERSISTENT_FILE" ]; then
. "$PERSISTENT_FILE"
local line
persistent_add `while read line; do echo ${line%%=*}; done <
"$PERSISTENT_FILE"`
fi
+ unlock_file "$PERSISTENT_FILE"
}


@@ -719,12 +721,15 @@ function real_persistent_load () {
function real_persistent_save () {
local VAR
local TMP
- > "$SPELL_CONFIG.p"
+ local file=$SPELL_CONFIG.p
+ local tfile=$(lock_start_transaction $file)
+ > "$tfile"
for VAR in $PERSISTENT_VARIABLES; do
config_get_option $VAR TMP
- echo "$VAR=\"$TMP\"" >> "$SPELL_CONFIG.p"
+ echo "$VAR=\"$TMP\"" >> "$tfile"
unset "$VAR"
done
+ lock_commit_transaction "$file"
unset PERSISTENT_VARIABLES
}




  • [SM-Commit] GIT changes to master sorcery by Andrew Stitt (0e543c1622d437d7072e7cc2e0a749792ccc8d27), Andrew Stitt, 11/25/2006

Archive powered by MHonArc 2.6.24.

Top of Page