Fix potential crash in exporttree database due to failure to honor uniqueness constraint
I don't know the circumstances, but have a report of this: git-annex: failed to commit changes to sqlite database: Just SQLite3 returned ErrorConstraint while attempting to perform step. All 3 tables in the export db have uniqueness constraints on them, insertUnique is used for all the rest, but this use of insertMany means it doesn't check the constraint. I guess that's what caused the crash, but I have not been able to test it yet. Use putMany when available, as it should be faster than mapM of insertMany. This commit was sponsored by Brock Spratlen on Patreon.
This commit is contained in:
parent
b8ed97f5d8
commit
def5d8b02c
2 changed files with 5 additions and 3 deletions
|
@ -12,6 +12,8 @@ git-annex (6.20180927) UNRELEASED; urgency=medium
|
||||||
that called them; this was not documented behavior and is no longer done.
|
that called them; this was not documented behavior and is no longer done.
|
||||||
* export: Fix false positive in export conflict detection, that occurred
|
* export: Fix false positive in export conflict detection, that occurred
|
||||||
when the same tree was exported by multiple clones.
|
when the same tree was exported by multiple clones.
|
||||||
|
* Fix potential crash in exporttree database due to failure to honor
|
||||||
|
uniqueness constraint.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 27 Sep 2018 15:27:20 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 27 Sep 2018 15:27:20 -0400
|
||||||
|
|
||||||
|
|
|
@ -126,10 +126,10 @@ addExportedLocation h k el = queueDb h $ do
|
||||||
let edirs = map
|
let edirs = map
|
||||||
(\ed -> ExportedDirectory (toSFilePath (fromExportDirectory ed)) ef)
|
(\ed -> ExportedDirectory (toSFilePath (fromExportDirectory ed)) ef)
|
||||||
(exportDirectories el)
|
(exportDirectories el)
|
||||||
#if MIN_VERSION_persistent(2,1,0)
|
#if MIN_VERSION_persistent(2,8,1)
|
||||||
insertMany_ edirs
|
putMany edirs
|
||||||
#else
|
#else
|
||||||
void $ insertMany edirs
|
mapM_ insertUnique edirs
|
||||||
#endif
|
#endif
|
||||||
where
|
where
|
||||||
ik = toIKey k
|
ik = toIKey k
|
||||||
|
|
Loading…
Reference in a new issue