Fix Unix.utimes not working for directories on Win32.#8796
Fix Unix.utimes not working for directories on Win32.#8796damiendoligez merged 4 commits intoocaml:trunkfrom dmbaturin:trunk
Conversation
|
I see that the Travis build failed due to missing Changes entry. Somehow I have missed that section in CONTRIBUTING.md, sorry. |
|
The change looks reasonable to me. Let's wait and see what @dra27 thinks. Yes, you need to add an entry to the Thanks! |
|
I'm afraid using I'm mildly surprised that the Python and Go guys weren't more suspicious. This could be partially mitigated by only specifying |
|
It would be good to have a fix for this in 4.10, but I'm afraid I'm not going to have time to deal with @stedolan's review comment in #8797. I propose one of these two:
I prefer the second, since it makes What do you think @nojb? |
Since this is a bug fix, wouldn't it be possible to get it into 4.10 even after the freeze ? In any case, 2 sounds OK as well. Unfortunately I am overloaded at the moment so I can't help getting this in shape for merging. |
|
@nojb If option 2 is agreed upon, I can do it myself. I haven't abandoned my PR. |
|
This and #8797 are both bug fixes and can be merged after the (imminent) branching of 4.10. |
|
@dmbaturin are you still willing to work on this? #8797 seems to be stalled as well. |
|
@damiendoligez / @Octachron - #8797 is too invasive to risk putting in 4.11 (but I'm gradually working through my backlog so I will be looking for its being merged before 4.12). However, the change here fixes a real bug in the same way as many other language libraries already do, so could we put this into 4.11 and then replace it with the comprehensive version in 4.12? |
|
@damiendoligez Sorry, I've neglected this indeed. I'm ready to get back to it if we have a course of action agreed upon. Do we? :) This proposal is no worse than mainstream, and to me it seems like security issues it may cause are mostly theoretical. However, I'm not a Windows expert by any means so I'd rather leave the final decision to @dra27. If there's anything you want me to change in this PR before it can be merged, I'm ready to do that. |
|
It seems to me that we have a course of action: merge this now and delay #8797 to 4.12. @dmbaturin if you could add a Changes entry, I'll merge this PR. |
|
@damiendoligez Done. Could you check? |
|
Thank you @dmbaturin for your contribution. |
On Win32,
Unix.utimesfails with EACCESS.The cause is that
CreateFile*functions need a special flag to work with directories,FILE_FLAG_BACKUP_SEMANTICS. Without it, it returns errno=6 (INVALID_HANDLE).See https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#directories
It appears to have no ill effects for normal files, and Python's
os.utimeimplementation on Win32 uses it: https://github.com/python/cpython/blob/master/Modules/posixmodule.c#L4830-L4859I'm by no means a Windows expert though, so this requires a review from someone who is.