Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening and closing MRD file via File interface updates file modified time #78

Open
gabuzi opened this issue Jul 19, 2024 · 1 comment

Comments

@gabuzi
Copy link

gabuzi commented Jul 19, 2024

Hi,

I noticed some strange behavior:

Just opening and closing again an MRD file via ismrmrd.File() as below updates the file modified timestamp.

import ismrmrd

with ismrmrd.File("mymrd.h5"):
    pass

After this, the mymrd.h5 file shows the current time as the time modified, which is surprising.
The sha256 checksum indicates no change in the file.

Opening and closing with ismrmrd.File(..., "r") does not show this behavior, which is reassuring.

I would expect the file modification timestamp to remain unchanged if the file is not modified.

Currently, this throws some of our tools off that take action based on updated files that it determines from modification timestamps.
It's not a critical issue as there is the workaround with the "r" flag, however it may be a cause for concern if readonly operations start changing file modification timestamps, especially on raw data that one would like to keep for archival purposes.

I spotted this behavior on Windows with python 3.10 and ismrmrd 1.14.1 installed via pip.
Due to a peculiarity in our setup, python will run as admin, which may or may not be relevant to this issue.

@gabuzi
Copy link
Author

gabuzi commented Jul 21, 2024

Additional context: Python's builtin file access behavior (e.g. with open("somefile"): ... does not touch files at all and defaults to the "r" mode, and I think it would make sense to match this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant