-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Assorted windows fixes for libutil, HANDLEs and path handling #14819
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
Conversation
| #ifdef _WIN32 | ||
|
|
||
| /** | ||
| * Windows speicifc replacement for POSIX lseek that operates on a HANDLE and not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Windows speicifc replacement for POSIX lseek that operates on a HANDLE and not | |
| * Windows specific replacement for POSIX `lseek` that operates on a `HANDLE` and not |
| #include "nix/util/windows-error.hh" | ||
| #include "nix/util/file-path.hh" | ||
|
|
||
| #ifdef _WIN32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ifdef seems stupid, but @Mic92 said it had to be there for `clang-tidy to work :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, we should instead be skipping these files with clang-tidy. That will get properly fixed in the clang-tidy wrapper.
5ffe8d1 to
f786741
Compare
This at least makes canonPath not consider the drive letter as a path component. There still some issues with it on windows, but at least this gets us through some of the libutil-tests. Also since we don't want to change which env variables nix considers we don't use std::filesystem::temp_directory_path and implement the windows version directly.
It doesn't track the number of bytes deleted, but since this code is security critical also we can split unix and windows implementations. If the need arises we can implement a smarter recursive deletion function ourselves in the future. Review with --color-moved.
For windows we should live fully in the HANDLE land instead of converting back-n-forth (which sometimes is destructive). Using native API is much better for this.
We need to signal the EOF condition, otherwise the read never terminates.
f786741 to
0695630
Compare
Motivation
Fixes quite a few issues on windows. With this and @Ericson2314's recent fixups for devshell I was able to get util-tests mostly passing on Wine:
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.