My apologies if this has been corrected in the meantime, but at least
part of the problem with that commit would be that in the first occurence
of boundToNitrogen->IsHydrogen() (line 367 in that github commit),
boundToNitrogen is a wild pointer - leading to the crash in Pascal
Muller's case (apparently only on 32bit x86 - and even there doing a
debug build is sufficient to mask the problem due to padding, but
probably returning a completely spurious result.
The initializsation of boundToNitrogen happens only in the second -
suspiciously similar FOR_BONDS_OF_ATOM loop (around line 383 in the 
commited code segment.

Regards 
Martin

> Dear David,
> 
> thanks for the great pointer, that's very helpful. I am working on it, I hope 
> I'll manage to get it done during the weekend.
> 
> Cheers,
> p.
> 
> > On 04 Jul 2014, at 10:59, David Hall <li...@cowsandmilk.net> wrote:
> > 
> > Hi Paolo,
> > 
> > Can you possibly look into what I describe in my message at
> > 
> > http://sourceforge.net/p/openbabel/mailman/message/31507998/ 
> > 
> > Testing today, 20,081 out of 24,867 molecules from VEHICLe cannot be 
> > roundtripped through the mol2 format in openbabel and be preserved.
> > 
> > removing the lines of code added to mol2format.cpp in this commit:
> > 
> > https://github.com/openbabel/openbabel/commit/097636fd7cdba1c842d27a80ccab809c558d0b98#diff-d6e9941b72192e2ba1a2d244948450ae
> > 
> > improves this to only 3,866 molecules not being successfully roundtripped. 
> > Unfortunately, deleting that code also means the pyridinium cation no 
> > longer works, which has made me not want to remove it, but instead try to 
> > find a fix that solves both this and the bug the code meant to fix.
> > 
> > -David
> > 
> > 
> > 
> > 
> >> On Fri, Jul 4, 2014 at 5:44 AM, Paolo Tosco <paolo.to...@unito.it> wrote:
> >> Dear Pascal,
> >> 
> >> thank you for reporting this - apologies for missing your previous 
> >> message. It was a while ago, but I remember that I was attempting to infer 
> >> the correct formal charges in the absence of explicit information in the 
> >> MOL2 format. It may well be that I inadvertently messed up something. I'll 
> >> have a look and see what's going wrong, then I'll get back to the list.
> >> 
> >> Sorry for the inconvenience, cheers
> >> p.
> >> 
> >> 
> >>> On 04/07/14 09:32, Pascal Muller wrote:
> >>> 
> >>> 
> >>> ---------- Forwarded message ----------
> >>> From: Pascal Muller <pascal.jm.mul...@gmail.com>
> >>> Date: 2014-05-09 10:51 GMT+02:00
> >>> Subject: Re: [Open Babel] C++ / segfault / "open file" change?
> >>> To: babel <openbabel-discuss@lists.sourceforge.net>
> >>> 
> >>> 
> >>> Hi,
> >>> 
> >>> Well, I got a little further.
> >>> Now, it's working with version 2.3.1, but not 2.3.2 and 2.3.90.
> >>> It seems somehow related to a "patch by Paolo Tosco 2012-06-07" in 
> >>> mol2format.cpp (not yet present in 2.3.1).
> >>> 
> >>> What I have with 2.3.2, when going line after line in mol2format.cpp:
> >>> 
> >>> 370                FOR_BONDS_OF_ATOM(bond3, partner) {
> >>> (gdb) 
> >>> 372                    n_h_bonded++;
> >>> (gdb) 
> >>> 
> >>> Program received signal SIGSEGV, Segmentation fault.
> >>> 0x02207c48 in OpenBabel::MOL2Format::ReadMolecule (this=0x220a488, 
> >>> pOb=0xbfffed50, pConv=0xbfffebd4)
> >>>     at /opt/OPENBABEL/openbabel-2.3.2/src/src/formats/mol2format.cpp:372
> >>> 372                    n_h_bonded++;
> >>> 
> >>> 
> >>> And with 2.3.90, which has some additionnal conditions:
> >>> 
> >>> 384        FOR_BONDS_OF_MOL(bond, mol)
> >>> (gdb) 
> >>> 386          if (bv[bond->GetIdx()] || (bond->GetBO() != 5))
> >>> (gdb) 
> >>> 391          if ( (bond->FindSmallestRing())->Size() != 6 )
> >>> (gdb) 
> >>> Program received signal SIGSEGV, Segmentation fault.
> >>> OpenBabel::MOL2Format::ReadMolecule (this=0x22cc5d0, pOb=0xbfffed50, 
> >>> pConv=0xbfffebd4)
> >>>     at /opt/OPENBABEL/openbabel-2.3.90/src/src/formats/mol2format.cpp:391
> >>> 391          if ( (bond->FindSmallestRing())->Size() != 6 )
> >>> 
> >>> 
> >>> 
> >>> My program read two mol2 files: a protein site and a ligand. With obabel, 
> >>> I can convert the ligand,  but conversion of the protein site is raising 
> >>> a segfault with 2.3.2 and 2.3.90, too.
> >>> The conversion of the protein site with 2.3.1 is OK.
> >>> According to gdb, the segfault with obabel is happening on the same line 
> >>> of mol2format.cpp.
> >>> 
> >>> obabel 3ku0_site27res.mol2 -O 3ku0_site27res_bab.mol2
> >>> 
> >>> I attach the site mol2 file to see if somebody else has the same problem.
> >>> 
> >>> 
> >>> Regards,
> >>> Pascal
> >>> 
> >>> 
> >>> 
> >>> ------------------------------------------------------------------------------
> >>> Open source business process management suite built on Java and Eclipse
> >>> Turn processes into business applications with Bonita BPM Community 
> >>> Edition
> >>> Quickly connect people, data, and systems into organized workflows
> >>> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> >>> http://p.sf.net/sfu/Bonitasoft
> >>> 
> >>> 
> >>> _______________________________________________
> >>> OpenBabel-discuss mailing list
> >>> OpenBabel-discuss@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> >> 
> >> 
> >> ------------------------------------------------------------------------------
> >> Open source business process management suite built on Java and Eclipse
> >> Turn processes into business applications with Bonita BPM Community Edition
> >> Quickly connect people, data, and systems into organized workflows
> >> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> >> http://p.sf.net/sfu/Bonitasoft
> >> _______________________________________________
> >> OpenBabel-discuss mailing list
> >> OpenBabel-discuss@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> > 

> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft> 
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

-- 
Dr. Martin Kroeker            mar...@ruby.chemie.uni-freiburg.de
c/o Prof.Dr. Caroline Roehr
Institut fuer Anorganische und Analytische Chemie der Universitaet Freiburg


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to