[gmx-developers] Segfault in append mode with TNG_IO

Luthaf luthaf at luthaf.fr
Mon Aug 29 14:52:51 CEST 2016


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
-- 
Luthaf


More information about the gromacs.org_gmx-developers mailing list