[gmx-developers] Segfault in append mode with TNG_IO

Magnus Lundborg magnus.lundborg at scilifelab.se
Mon Aug 29 15:44:27 CEST 2016

Hi Luthaf,

I will look into this and report back. I am a bit busy right now, but 
hopefully there will be a solution within a few days.



On 08/29/2016 02:52 PM, Luthaf wrote:
> Hello,
> I am trying to integrate the TNG file format in my chemistry IO 
> library (http://chemfiles.github.io/), but I have an issue with the 
> "append" mode.
> When I do the following set of operation on a file which already 
> contains trajectory block, I get a segfault:
>     tng_trajectory_t handle;
> tng_util_trajectory_open(filename, 'a', &handle);
> tng_file_headers_read(handle, TNG_USE_HASH);
> tng_last_program_name_set(handle, "chemfiles");
> tng_file_headers_write(handle, TNG_USE_HASH);
> Running the code in a debugger tell me that the segfault is 
> [here](https://github.com/gromacs/tng/blob/cdf1aa2e586fb6a6050a5387257b504dc02294e7/src/lib/tng_io.c#L5699) 
> and it looks like it is because this 
> [test](https://github.com/gromacs/tng/blob/cdf1aa2e586fb6a6050a5387257b504dc02294e7/src/lib/tng_io.c#L5654-L5663) 
> assumes I am writting a trajectory block, even if I am not.
> The tests suite (tng_testing) runs fine on my computer. And if that 
> can help, my code is available 
> [here](https://github.com/chemfiles/chemfiles/blob/8e038dbcc7c883b395d25165d991ceee3a7b1af7/src/files/TNGFile.cpp), 
> and I am using the example file distributed with the tng_io git 
> repository.
> Cheers

More information about the gromacs.org_gmx-developers mailing list