Skip to content

Conversation

@xokdvium
Copy link
Contributor

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:

[----------] Global test environment tear-down
[==========] 603 tests from 117 test suites ran. (2537 ms total)
[  PASSED  ] 598 tests.
[  FAILED  ] 5 tests, listed below:
[  FAILED  ] FSSourceAccessorTest.works
[  FAILED  ] absPath.doesntChangeRoot
[  FAILED  ] isInDir.emptyDir
[  FAILED  ] makeParentCanonical.root
[  FAILED  ] chmodIfNeeded.works

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@xokdvium xokdvium requested a review from Ericson2314 December 17, 2025 21:00
@xokdvium xokdvium requested a review from edolstra as a code owner December 17, 2025 21:00
#ifdef _WIN32

/**
* Windows speicifc replacement for POSIX lseek that operates on a HANDLE and not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

#include "nix/util/windows-error.hh"
#include "nix/util/file-path.hh"

#ifdef _WIN32
Copy link
Member

@Ericson2314 Ericson2314 Dec 17, 2025

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 :/

Copy link
Contributor Author

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.

@xokdvium xokdvium disabled auto-merge December 17, 2025 21:10
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.
@Ericson2314 Ericson2314 added this pull request to the merge queue Dec 17, 2025
Merged via the queue into master with commit 1aa7ab0 Dec 18, 2025
20 checks passed
@Ericson2314 Ericson2314 deleted the mingw-fixes-more branch December 18, 2025 00:08
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

Successfully merging this pull request may close these issues.

2 participants