Bug #3227

solvate does not check return status of gmx_file_rename

Added by Eric Irrgang about 1 year ago.

core library
Target version:
Affected version - extra info:
Affected version:


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

Related to GROMACS - Bug #3202: gmx solvate fails to overwrite topology fileNew

Associated revisions

Revision 07e0bf13 (diff)
Added by Eric Irrgang about 1 year ago

Improve pytest fixtures for directory management.

  • Add a pytest command line option to control whether to remove
    temporary directories always, never, or conditionally upon test success.
  • Encapsulate context managers and test fixtures for tempdir removal,
    temporary changes of working directory, and access to the new pytest
    command line argument.
  • Use a context manager to use the temporary testing directories
    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 files.
Consolidation into the gmxapi.testsupport module is deferred to a
separate change.

Refs #3227

Change-Id: I703d1e3806f7b4d8f2ae3b80c39ec64acd9cf3b4


#1 Updated by Eric Irrgang about 1 year ago

  • Related to Bug #3202: gmx solvate fails to overwrite topology file added

Also available in: Atom PDF