Bug #3227
solvate does not check return status of gmx_file_rename
Description
The update_top() function in solvate.cpp concludes with a call to gmx_file_rename(temporary_filename, topinout);
but does not handle failure. Instead, solvate quietly completes without error, but leaves a stray temporary file and/or missing topology file.
Failures in rename could occur due to failures in preceding commands, such as make_backup, or due to filesystem access restrictions.
Since the temporary file is created in the working directory, rather than in the directory where the target file is located, there are extra possible failure cases based on directory permissions or cross-filesystem moves. (Note there is an incorrect inline comment about the atomicity of rename
, which is only atomic when source and target are on the same filesystem.)
errno should also be checked.
This probably affects several versions, but could be affected by change history in futil.cpp, temporary file management, or working directory management.
Related issues
Associated revisions
History
#1 Updated by Eric Irrgang about 1 year ago
- Related to Bug #3202: gmx solvate fails to overwrite topology file added
Improve pytest fixtures for directory management.
temporary directories always, never, or conditionally upon test success.
temporary changes of working directory, and access to the new pytest
command line argument.
for working directory, as well. Works around potential issues
with GROMACS creating temporary files in different directories
(or filesystems) from where they are relevant.
This change makes identical changes to 3 different conftest.py files.
Consolidation into the gmxapi.testsupport module is deferred to a
separate change.
Refs #3227
Change-Id: I703d1e3806f7b4d8f2ae3b80c39ec64acd9cf3b4