You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Unix, when opening a file with std::fs::File::open(), the file is opened with O_RDONLY mode but the access timestamp in the file metadata is updated (see https://github.com/posborne/rust-systems-programming/blob/master/file-io.md and man 7 inode). In the case of infer, trying to infer a file type with infer::get_from_path should be without this side effect as it is on Windows where the file type can be deducted from the extension.
The way to do it is to open the file with the mode O_NOATIME, that can be done with the following code:
// We open the file without changing the access time in the metadatalet mode = (libc::O_RDONLY | libc::O_NOATIME).try_into().unwrap();letmut file = OpenOptions::new().mode(mode).open(entry.path())?;
Please change infer::get_from_path to remove this side effect.
The text was updated successfully, but these errors were encountered:
On Unix, when opening a file with
std::fs::File::open()
, the file is opened withO_RDONLY
mode but the access timestamp in the file metadata is updated (see https://github.com/posborne/rust-systems-programming/blob/master/file-io.md andman 7 inode
). In the case of infer, trying to infer a file type withinfer::get_from_path
should be without this side effect as it is on Windows where the file type can be deducted from the extension.The way to do it is to open the file with the mode
O_NOATIME
, that can be done with the following code:Please change
infer::get_from_path
to remove this side effect.The text was updated successfully, but these errors were encountered: