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

set_symlink_file_times doesn't change atime but causes it to become UTIME_NOW on Linux #106

Open
l-0-l opened this issue May 1, 2024 · 0 comments

Comments

@l-0-l
Copy link

l-0-l commented May 1, 2024

There is no specific function to change only the atime for links. It could be nice if set_times was public, as this may be the only function you need. But when using set_symlink_file_times you must first get the current link metadata, which is also inefficient, and then change both the mtime and the atime, providing the one you don't want to change from the metadata. Specific functions like set_file_atime provide a None to the relevant FileTime in set_times, which then converts it to an OS-specific UTIME_OMIT for the system call or whatever in Windows. Unlike in Windows implementation's set_file_handle_times corresponding function, though, which does accept Option<FileTime> and is public, in Linux using set_times sin't an option.

When I try to set atime only by providing mtime from the original link's metadata with set_symlink_file_times, the link's 'atime' becomes the current system time on Debian 12 x86-64 default ext4 filesystem. It works well for me the other way round, though, I am not sure why.

Proposed solutions:

  • Add specific set_symlink_file_atime and set_symlink_file_mtime to both Windows and Linux implementations.
  • Remove the set_symlink_file_times entirely and add a flag like follow_links to the normal file functions like set_file_atime.
  • Make set_times public, like the set_file_handle_times in Windows.
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