Commit Graph

23086 Commits

Author SHA1 Message Date
Sergei Zimmerman
c28203f097 libcmd,daemon: Reap children via a self-pipe trick
Somewhat better solution for https://github.com/NixOS/nix/issues/15394. Instead
of reaping immediately in the signal handler we instead punt that at the poll loop.
This way Pid destructor has a chance to properly run instead of being rudely interrupted
by the signal handler.

See: https://man7.org/tlpi/code/online/dist/altio/self_pipe.c.html
2026-03-05 04:08:34 +03:00
Sergei Zimmerman
116af62b8e Merge pull request #15402 from sheeeng/patch-1
fix: typographical error
2026-03-04 13:09:24 +00:00
Leonard Sheng Sheng Lee
6be774a9ed fix: typographical error
Modify `derivatons` to `derivations`.
2026-03-03 22:15:07 +01:00
John Ericson
9a30578624 Merge pull request #15401 from NixOS/more-nofollow
Expose FinalSymlink argument in more places, sprinkle more O_NOFOLLOW in various places
2026-03-03 21:13:27 +00:00
Sergei Zimmerman
ae955594d6 libutil: Use Source::drainInto with explicit size parameter in PosixSourceAccessor::readFile
Slightly cleaner. We dont need any of the NONBLOCK logic from drainFD
here since the source is a regular file + this would allow to stuff copy_file_range/sendfile
into the FdSource for more efficient copying to a file descriptor.
2026-03-03 22:22:50 +03:00
Sergei Zimmerman
26679828f7 libutil,libstore: Expose FinalSymlink in writeFile arguments, use in LocalStore
This exposes the knob for controlling final symlink following in
writeFile with O_TRUNC (which I've previously marked with FIXMEs, since that was
quite suspicious looking). Use DontFollow in restorePath for `flat` serialisation
case. Callers already have the invariant that a regular file will be written to
the destination path (which has been deleted recursively via deletePath for good measure).
This just adds for guardrails against any possible SNAFUs.
2026-03-03 22:09:38 +03:00
Sergei Zimmerman
a8d51a0c59 libutil: Address TODO O_NOFOLLOW in recursiveSync 2026-03-03 21:49:06 +03:00
Sergei Zimmerman
17ced6f80c libutil: Add finalSymlink argument to openFileReadonly
We have a couple of places where this would end up being useful.
2026-03-03 21:46:46 +03:00
John Ericson
b516291bea Merge pull request #15399 from NixOS/fixed-length-drain-into
Introduce `Source::drainInto` with explicit length
2026-03-03 17:44:58 +00:00
John Ericson
57e0ad01e7 Merge pull request #15397 from NixOS/fix-various-error-messages-warnings
Improve formatting of various errors and warnings
2026-03-03 17:34:57 +00:00
John Ericson
5e84b57594 Introduce Source::drainInto with explicit length
This is used to deduplicate two spots in the code:

- `git::parseBlob`

- `parseContents` in `archive.cc`

Implementation is a bit more hardened than either of the two originals.
2026-03-03 11:40:45 -05:00
Sergei Zimmerman
6bedefea9e Improve formatting of various errors and warnings
Removes unnecessary `error: warning:` prefixes by using .message() and not .msg().
Also includes attempt counts in the filetransfer warnings. Removes a redundant trace
from the filetransfer errors with FileTransferError (which is already descriptive enough)
and contains the same information basically.
2026-03-03 18:50:17 +03:00
Jörg Thalheim
fa1a370c6f Merge pull request #15386 from NixOS/relative-url-tests
Relative url tests
2026-03-03 08:37:30 +00:00
Jörg Thalheim
c0b4227573 Merge pull request #15387 from NixOS/dependabot/github_actions/actions/download-artifact-8.0.0
build(deps): bump actions/download-artifact from 7.0.0 to 8.0.0
2026-03-03 08:36:38 +00:00
Jörg Thalheim
a2f73abde3 Merge pull request #15388 from NixOS/dependabot/github_actions/actions/upload-artifact-7
build(deps): bump actions/upload-artifact from 6 to 7
2026-03-03 08:36:12 +00:00
John Ericson
c6562fd938 Merge pull request #15391 from obsidiansystems/fix-unix-test-assumptions
Fix unix test assumptions
2026-03-03 06:48:17 +00:00
Jörg Thalheim
0bb0f69f6c Merge pull request #15365 from DigitalBrewStudios/shortname-bundle-bundler
feat(nix): add shortname to bundle bundler arg
2026-03-03 06:37:51 +00:00
Amaan Qureshi
5bedf61b83 tests: fix two assertion crashes during Windows test teardown 2026-03-03 01:01:55 -05:00
Amaan Qureshi
70c6e0a399 tests: use Windows-absolute paths in LocalStore/LocalOverlayStore config tests 2026-03-03 01:01:55 -05:00
Amaan Qureshi
f17d9dee9e tests: use empty temp file instead of /dev/null in machines test 2026-03-03 01:01:55 -05:00
Amaan Qureshi
9534543860 tests: skip and fix nix_api_store tests for Windows/Wine 2026-03-03 01:01:55 -05:00
Amaan Qureshi
08efb2b454 tests: skip symlink-dependent nix_api tests on Windows 2026-03-03 00:06:02 -05:00
Amaan Qureshi
72abbc4164 libstore: use urlPathToPath for store URL path parsing
`store-registration.hh` constructed a `std::filesystem::path` directly
from `percentDecode(uri)`, which broke on Windows because file:// URLs
like `/C:/foo` lack a drive-letter root. Replace with `splitString` +
`urlPathToPath`, which handles Windows drive-letter stripping.
2026-03-03 00:06:02 -05:00
John Ericson
8f6c05ee7a Merge pull request #15390 from obsidiansystems/portable-dup
libutil: Add dupDescriptor function
2026-03-03 04:30:44 +00:00
John Ericson
3df8dbc07c libutil: Add dupDescriptor function
Add a cross-platform function for duplicating file descriptors:
- Unix: uses fcntl(F_DUPFD_CLOEXEC)
- Windows: uses DuplicateHandle

This is useful when code needs to take ownership of a borrowed
descriptor.
2026-03-02 22:39:02 -05:00
John Ericson
05855f5d2a Merge pull request #15009 from amaanq/signature-type
protocol: update JSON output with structured `Signature` type
2026-03-03 02:10:44 +00:00
Amaan Qureshi
d7245ff8ac protocol: update JSON output with structured Signature type
This commit updates the JSON output with a Signature type containing
keyName and sig fields. JSON parsing accepts both formats for backwards
compatibility.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2026-03-02 20:18:43 -05:00
dependabot[bot]
539c6a1aaf build(deps): bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 23:39:12 +00:00
dependabot[bot]
faa16841b6 build(deps): bump actions/download-artifact from 7.0.0 to 8.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](37930b1c2a...70fc10c6e5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 23:39:07 +00:00
Jörg Thalheim
2d0c5421a5 Merge pull request #15383 from roberth/alt-15300
fix(libexpr-c): pass valid EvalState to primop callback
2026-03-02 21:01:34 +00:00
John Ericson
800d92449f Merge pull request #15376 from obsidiansystems/filesystem-cleanups
Some filesystem cleanups
2026-03-02 20:21:00 +00:00
Robert Hensing
6633c55f8a fix(libexpr-c): pass valid EvalState to primop callback
Due to an erroneous cast, the wrong pointer was passed to these
callbacks, leading to a crash.

We now create a lightweight temporary EvalState wrapper on the stack in each
callback bridge. This also eliminates the need for unsafe_new_with_self
for EvalState construction.

Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
2026-03-02 21:11:20 +01:00
Sergei Zimmerman
5f5b043524 Merge pull request #15382 from roberth/extra-release-notes-2.34
Extra release notes 2.34
2026-03-02 20:03:34 +00:00
John Ericson
4f8f581830 libutil: Reimplement *stat functions on Windows for symlink support
Reimplement `lstat` and `maybeLstat` from first principles on Windows
so they work with symlinks. Properly define `S_IFLNK` and `S_ISLNK`.

Use `GetFileAttributesExW` instead of `_wstat64` since the latter
doesn't properly detect symlinks (reparse points) on Windows.

Key changes:
- Add `S_IFLNK` (0120000) and proper `S_ISLNK` macro for Windows
- Add `windows::fileTimeToUnixTime` to convert FILETIME to Unix time_t
- Add `windows::statFromFileInfo` to populate PosixStat from Windows
  file attributes
- Move `lstat` and `maybeLstat` to platform-specific files
  (unix/file-system.cc and windows/file-system.cc)
- Move `fstat` from file-system.hh to file-system-at.hh, changing
  signature from `int fd` to `Descriptor fd` for cross-platform support
- Windows `lstat` now detects symlinks via FILE_ATTRIBUTE_REPARSE_POINT
  and sets S_IFLNK in st_mode
- Windows `fstat` uses GetFileInformationByHandle

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
2026-03-02 14:30:32 -05:00
Sergei Zimmerman
5f666eff14 Add release note for GHCR Docker images
(cherry picked from commit 5d054fe91ef95650ba7a7925b15ed9acfc0e7006)
2026-03-02 20:20:45 +01:00
Robert Hensing
62a78c86b0 release notes 2.34: add entries for additional PRs 2026-03-02 20:20:45 +01:00
Jörg Thalheim
35be9ef560 Merge pull request #15322 from obsidiansystems/build-trace-rework
Realisations use regular drv paths again
2026-03-02 19:16:24 +00:00
Sergei Zimmerman
94dbeec833 Merge pull request #15379 from NixOS/bump-version
Bump version
2026-03-02 19:13:22 +00:00
John Ericson
3ed992a3fd Merge pull request #15377 from obsidiansystems/fix-windows-url-paths
Fix windows url paths
2026-03-02 18:38:17 +00:00
Jörg Thalheim
855208ba24 docs: add release notes for build trace rework
The previous commit changed CA derivation realisations to be keyed by
store path instead of hash modulo, affecting binary cache and wire
protocols. Users and tool authors need to understand the impact on
binary cache layout, protocol negotiation, and what migration looks
like.

This documents the key changes: the new build-trace-v2/ cache directory,
the split key/value JSON format, worker protocol feature negotiation,
serve protocol version bump, and the fact that non-CA users are
unaffected.
2026-03-02 13:28:17 -05:00
Sergei Zimmerman
ca42db38a3 Bump version 2026-03-02 21:24:05 +03:00
John Ericson
faca7db633 Revert "Reapply "Use the hash modulo in the derivation outputs""
This reverts commit 100e7cc337.

Unlike the last version, this fixes `--print-out-paths` for old clients

When the client lacks `featureRealisationWithPath` (worker) or version <
2.8 (serve), the daemon was sending an empty `StringMap` for
`builtOutputs`, causing `--print-out-paths` to print nothing. This
commit constructs the old wire format instead, using a dummy `sha256:`
hash since the derivation hash no longer exists. Old clients only need
the output name and path from the JSON.
2026-03-02 13:11:21 -05:00
John Ericson
450c1850c9 libutil: Add finalSymlink parameter to openDirectory
Add a type-safe boolean enum `FinalSymlink` to control whether
`openDirectory` follows symlinks on the final path component.

- `FinalSymlink::Follow` (default): follow symlinks (current behavior)
- `FinalSymlink::DontFollow`: fail if the path is a symlink

On Unix, this uses `O_NOFOLLOW`. On Windows, this uses
`FILE_FLAG_OPEN_REPARSE_POINT`.

Update all call sites with explicit `FinalSymlink` values.
2026-03-02 12:57:06 -05:00
Amaan Qureshi
0d8ca7a888 fetchers: use pathToUrlPath in PathInputScheme::toURL 2026-03-02 12:46:16 -05:00
Amaan Qureshi
9c59f62890 url: handle Windows drive letters in fixGitURL 2026-03-02 12:45:36 -05:00
Amaan Qureshi
f3792cdad5 flakeref: use portable root detection in directory walk loops 2026-03-02 12:45:36 -05:00
Amaan Qureshi
b26f2ca3e6 tests: clear NIX_STORE env in fetchers, expr, and flake test environments 2026-03-02 12:45:36 -05:00
Amaan Qureshi
62d275d7c0 tests: use pathToUrlPath for file:// URL construction in git test 2026-03-02 12:45:36 -05:00
Sergei Zimmerman
ee5381a376 Merge pull request #15331 from lisanna-dettwyler/github-fetcher-url-param-check
Error on invalid URL param in github fetcher
2026-03-02 17:35:39 +00:00
John Ericson
e19c0a5a14 Add test cases for relative ? and # empty explicit params vs none at all
Unlike with absolute (complete) URLs, with relative URLs, this does make
a difference -- explicit empty overrides, implicit empty does not.
2026-03-02 11:51:25 -05:00