Assorted windows fixes for libutil, HANDLEs and path handling#14819
Merged
Ericson2314 merged 4 commits intomasterfrom Dec 18, 2025
Merged
Assorted windows fixes for libutil, HANDLEs and path handling#14819Ericson2314 merged 4 commits intomasterfrom
Ericson2314 merged 4 commits intomasterfrom
Conversation
Ericson2314
reviewed
Dec 17, 2025
| #ifdef _WIN32 | ||
|
|
||
| /** | ||
| * Windows speicifc replacement for POSIX lseek that operates on a HANDLE and not |
Member
There was a problem hiding this comment.
Suggested change
| * 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 |
Ericson2314
reviewed
Dec 17, 2025
| #include "nix/util/windows-error.hh" | ||
| #include "nix/util/file-path.hh" | ||
|
|
||
| #ifdef _WIN32 |
Member
There was a problem hiding this comment.
This ifdef seems stupid, but @Mic92 said it had to be there for `clang-tidy to work :/
Contributor
Author
There was a problem hiding this comment.
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
Ericson2314
approved these changes
Dec 17, 2025
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
Ericson2314
approved these changes
Dec 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.