summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-02-23 18:33:50 +0300
committerdefanor <defanor@uberspace.net>2018-02-23 18:39:36 +0300
commit994485a855267dda40f6d656c33f4ec68903fda8 (patch)
tree90e8074b6752f850c4916d75e90d16522305a0fd
parent339a7f006527ad1f1e5b499bc620dd020e796df7 (diff)
Force the triples with deepseq
Not quite sure if it's the proper fix, but appears to fix an occasional segfault on RDF reading.
-rw-r--r--Text/Pandoc/Readers/RDF.hs7
-rw-r--r--pancake.cabal3
2 files changed, 7 insertions, 3 deletions
diff --git a/Text/Pandoc/Readers/RDF.hs b/Text/Pandoc/Readers/RDF.hs
index 23d3ca7..0d9aa26 100644
--- a/Text/Pandoc/Readers/RDF.hs
+++ b/Text/Pandoc/Readers/RDF.hs
@@ -48,6 +48,7 @@ import System.Directory ( getXdgDirectory, XdgDirectory(..)
, createDirectoryIfMissing )
import Control.Monad (zipWithM)
import Data.Maybe (mapMaybe)
+import Control.DeepSeq
import Redland
@@ -157,8 +158,9 @@ readRDF bu rf t = do
cacheDir <- getXdgDirectory XdgCache "pancake"
createDirectoryIfMissing True cacheDir
withWSMU "hashes" [("hash-type", "bdb"), ("dir", cacheDir)]
- "rdf-cache" "" (uriToString id bu "") $ \world' _ model' _ ->
- mapM (readTriple (world', model')) $ prepareTriples triples
+ "rdf-cache" "" (uriToString id bu "") $ \world' _ model' _ -> do
+ r <- mapM (readTriple (world', model')) $ prepareTriples triples
+ r `deepseq` pure r
readTriple :: ( ForeignPtr RedlandWorld
, ForeignPtr RedlandModel)
-> Triple
@@ -170,3 +172,4 @@ readRDF bu rf t = do
-- rdfproc rdf-cache parse http://xmlns.com/foaf/0.1/
-- rdfproc rdf-cache parse http://www.w3.org/1999/02/22-rdf-syntax-ns
+-- rdfproc rdf-cache parse http://www.w3.org/2000/01/rdf-schema
diff --git a/pancake.cabal b/pancake.cabal
index a1455c0..572fc5a 100644
--- a/pancake.cabal
+++ b/pancake.cabal
@@ -47,6 +47,7 @@ executable pancake
, bytestring >= 0.10.8.1 && < 1
, containers >= 0.5.7.1 && < 1
, data-default >= 0.7.1.1 && < 1
+ , deepseq >= 1.4.2.0 && < 2
, directory >= 1.2.6.2 && < 2
, filepath >= 1.4.1.0 && < 2
, haskeline >= 0.7 && < 1
@@ -59,13 +60,13 @@ executable pancake
, pandoc-types >= 1.17.0.5 && < 2
, parsec >= 3.1.11 && < 4
, process >= 1.6 && < 2
+ , redland == 0.1.0.0
, regex-base >= 0.93.2 && < 1
, regex-tdfa >= 1.2.2 && < 2
, terminfo >= 0.4.0.2 && < 1
, text >= 1.2.2.2 && < 2
, unix >= 2.7.2.0 && < 3
, yaml >= 0.8.23.3 && < 1
- , redland == 0.1.0.0
-- hs-source-dirs:
default-language: Haskell2010
ghc-options: -Wall