summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorKei Kebreau <kkebreau@posteo.net>2018-07-21 12:47:34 -0400
committerKei Kebreau <kkebreau@posteo.net>2018-07-21 22:28:51 -0400
commiteb5ece73a84439d21219a802c0dcb88d54046371 (patch)
tree98c5f0d4ce0b3979d2d7d80f6d918171211c5889 /gnu
parent889e7fab3c04be98a59b880bf44fbdaa6ddf0a4e (diff)
gnu: openbabel: Fix crash when opening NWChem output files.
* gnu/packages/patches/openbabel-fix-crash-on-nwchem-output.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/chemistry.scm (openbabel)[source]: Use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/chemistry.scm4
-rw-r--r--gnu/packages/patches/openbabel-fix-crash-on-nwchem-output.patch34
3 files changed, 38 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index e55c2bf3ba..8ad81e6935 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -979,6 +979,7 @@ dist_patch_DATA = \
%D%/packages/patches/ocaml-graph-honor-source-date-epoch.patch \
%D%/packages/patches/omake-fix-non-determinism.patch \
%D%/packages/patches/ola-readdir-r.patch \
+ %D%/packages/patches/openbabel-fix-crash-on-nwchem-output.patch \
%D%/packages/patches/opencascade-oce-glibc-2.26.patch \
%D%/packages/patches/openblas-fix-tests-i686.patch \
%D%/packages/patches/openexr-missing-samples.patch \
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index a81c14b43c..418b4be2f4 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -213,7 +213,9 @@ NumPy < 1.9.")
version "/" name "-" version ".tar.gz"))
(sha256
(base32
- "1z3d6xm70dpfikhwdnbzc66j2l49vq105ch041wivrfz5ic3ch90"))))
+ "1z3d6xm70dpfikhwdnbzc66j2l49vq105ch041wivrfz5ic3ch90"))
+ (patches
+ (search-patches "openbabel-fix-crash-on-nwchem-output.patch"))))
(build-system cmake-build-system)
(arguments
`(#:configure-flags
diff --git a/gnu/packages/patches/openbabel-fix-crash-on-nwchem-output.patch b/gnu/packages/patches/openbabel-fix-crash-on-nwchem-output.patch
new file mode 100644
index 0000000000..879df026a1
--- /dev/null
+++ b/gnu/packages/patches/openbabel-fix-crash-on-nwchem-output.patch
@@ -0,0 +1,34 @@
+From 52cea818bf68f8a2d3c48d55d00c2f8b7da25e4c Mon Sep 17 00:00:00 2001
+From: Daniel Hogan <daniel.hogan@usask.ca>
+Date: Tue, 28 Mar 2017 22:21:18 -0600
+Subject: [PATCH] Remove delete statement.
+
+When from_scratch is true, coordinates is not allocated. A separate if
+statement was added to handle the case when from_scratch is true that
+does not try to free coordinates.
+---
+ src/formats/nwchemformat.cpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/formats/nwchemformat.cpp b/src/formats/nwchemformat.cpp
+index 6f625ad5b..79298555f 100644
+--- a/src/formats/nwchemformat.cpp
++++ b/src/formats/nwchemformat.cpp
+@@ -232,11 +232,14 @@ static const char* OPTIMIZATION_END_PATTERN = " Optimization converged";
+ break;
+ tokenize(vs,buffer);
+ }
+- if ((from_scratch)||(i != natoms))
+- {
++ if (from_scratch)
++ {
++ return;
++ }
++ if (i != natoms) {
+ delete[] coordinates;
+ return;
+- }
++ }
+ molecule->AddConformer(coordinates);
+ }
+