Permalink
Browse files

Protect calls to Filehash from user interrupts

Calls to Filehash have been protected using `evalWithoutInterruptions`. This
should prevent rogue lockfiles and corrupted databases.

Calls which needed to be protected:

  - dbExists

  - dbFetch

  - dbInsert

These all invoke the acquisition of a lockfile. `dbExists` does this indirectly by
calling `dbList` which actually acquires the lockfile.
  • Loading branch information...
1 parent 407c52a commit ff0d4c7411d5d761debe875c4fbde6dc305f7397 @Sharpie committed Jan 23, 2012
Showing with 7 additions and 5 deletions.
  1. +4 −5 R/cacheMetrics.R
  2. +3 −0 README.md
View
@@ -18,10 +18,11 @@ function( key )
checkDictionaryStatus()
# Check for the string.
- if ( dbExists(.tikzInternal[['dictionary']], sha1(key)) ) {
+ haveMetrics <- evalWithoutInterrupts(dbExists(.tikzInternal[['dictionary']], sha1(key)))
+ if ( haveMetrics ) {
# Yay! The width exists! Recover and return it.
- metrics <- dbFetch(.tikzInternal[['dictionary']], sha1(key))
+ metrics <- evalWithoutInterrupts(dbFetch(.tikzInternal[['dictionary']], sha1(key)))
} else {
@@ -41,12 +42,10 @@ function( key )
storeMetricsInDictionary <-
function( key, metrics )
{
-
- dbInsert(.tikzInternal[['dictionary']], sha1(key), metrics)
+ evalWithoutInterrupts(dbInsert(.tikzInternal[['dictionary']], sha1(key), metrics))
# Return nothing.
invisible()
-
}
View
@@ -136,6 +136,9 @@ Latest Changes
- Creating raster output with the tikzDevice could mess with the behavior of
some graphical paramaters such as par('mfrow'). This has been fixed.
+ - Calls to the Filehash package have been protected from user interruptions.
+ This should prevent rogue lockfiles and corrupted metrics dictionaries.
+
#### Behind the Scenes
- The tikzDevice now requires R 2.12.0 or later.

0 comments on commit ff0d4c7

Please sign in to comment.