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

Don't follow symbolic links #6

Closed
1024mb opened this issue Jan 22, 2022 · 6 comments
Closed

Don't follow symbolic links #6

1024mb opened this issue Jan 22, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@1024mb
Copy link

1024mb commented Jan 22, 2022

Could an option to ignore symlinks be added? Currently it follows the symlink and the actual file gets updated.

@Delgan
Copy link
Owner

Delgan commented Jan 22, 2022

Hi.

That sounds like a good idea. I added a new follow_symlinks argument (defaults to True) to the setctime()function.

You can uprade to 1.1.0 to use it. 👍

@Delgan Delgan closed this as completed Jan 22, 2022
@Delgan Delgan added the enhancement New feature or request label Jan 22, 2022
@1024mb
Copy link
Author

1024mb commented Jan 23, 2022

@Delgan I just tried it and it works great. Can you please make a module for mtime and atime? I'm asking because os.utime doesn't support follow_symlinks on Windows and your module does.

@Delgan
Copy link
Owner

Delgan commented Jan 23, 2022

The documentation of os.utime() states you can use follow_symlinks=False. Are you saying this parameter does not work on Windows?

@1024mb
Copy link
Author

1024mb commented Jan 23, 2022

Yes, I've tried it and it doesn't work, you will get something along the lines that follow_symlinks is not supported on this platform. Even querying os.utime in os.supports_follow_symlinks returns False.

@Delgan
Copy link
Owner

Delgan commented Jan 23, 2022

Ok, thanks. I didn't know the support for symlinks was platform dependent, there even exists os.supports_follow_symlinks to list supported functions.

I'm sorry but I prefer not to add the utime() support to this library. It wouldn't fit its name, it was only meant to change the st_ctime attribute and my usage does not require modifying the other ones.

Ideally, support for symlinks should be added directly to the official Python implementation. I looked at the code a bit, and after finding the implementation I opened a feature request: https://bugs.python.org/issue46490

Maybe the os.utime() function will be improved.

@1024mb
Copy link
Author

1024mb commented Jan 24, 2022

I'm sorry but I prefer not to add the utime() support to this library.

I was not referring to add support to setctime but to create another module.
Either way, hopefully support it's added in next versions of Python. Thanks for opening the issue.

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

No branches or pull requests

2 participants