Discngine / fpocket

fpocket is a very fast open source protein pocket detection algorithm based on Voronoi tessellation. The platform is suited for the scientific community willing to develop new scoring functions and extract pocket descriptors on a large scale level. fpocket is distributed as free open source software. If you are interested in integrating fpocket in an industrial setting and require official support, please contact Discngine (www.discngine.com).
MIT License
271 stars 60 forks source link

Wrong folder used for output files with fpocket [debian:11-slim] #108

Closed odemengeon closed 7 months ago

odemengeon commented 1 year ago

Describe the bug fpocket try store files in / where ever is the input file

To Reproduce

  1. In any folder, for example /tmp/Z
  2. put a pdb file in the folder, for example z.pdb
  3. from /tmp/Z, launch fpocket: fpocket -f z.pdb
  4. Error: POCKET HUNTING BEGINS ! The file /z_VMD.sh could not be opened! ! The file /z_PYMOL.sh could not be opened! ! The file /z_out.pdb could not be opened! Segmentation fault (core dumped)

Expected behavior No crash and output file stored where the pdb file is stored

Desktop (please complete the following information):

Source of problem: in src/fpout.c, the function write_out_fpocket use 2 times sprintf with destination and source using same memory buffer (out_path) and as the manual explain: C99 and POSIX.1-2001 specify that the results are undefined if a call to sprintf(), snprintf(), vsprintf(), or vsnprintf() would cause copying to take place between objects that overlap (e.g., if the target string array and one of the supplied input arguments refer to the same buffer). Using a temporary buffer, seems fix the issue at least in fpocket called only with -f

pschmidtke commented 8 months ago

oh interesting one, that might be because you are working in /tmp, will check that out.

pschmidtke commented 7 months ago

Looking into this now. Cannot reproduce the error at all. However I guess I identified the line (88) you refer to @odemengeon :

      sprintf(out_path, "%s/%s", out_path, pdb_code); 
pschmidtke commented 7 months ago

adressed & merged in different PR -> already on current master