1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 15:32:43 +01:00
Commit graph

18866 commits

Author SHA1 Message Date
Sergei Zimmerman
fd86343b89 {libutil,libexpr}: Move pos-idx,pos-table code to libutil
All of this code doesn't actually depend on anything from
libexpr. Because Pos is so tigtly coupled with Error, it
makes sense to have in the same library.

(cherry picked from commit a53b184e63)
2025-03-24 16:05:31 +00:00
tomberek
7e9be2b924
Merge pull request #12744 from NixOS/mergify/bp/2.25-maintenance/pr-12714
`MonitorFdHup`: replace `pthread_cancel` trick with a notification pipe (backport #12714)
2025-03-24 11:21:55 -04:00
Jörg Thalheim
76098180d2 MonitorFdHup::~MonitorFdHup: use proper close method instead of libc close()
Otherwise closing it again will cause an EBADF in the AutoCloseFd class.

(cherry picked from commit 87a34a45ff)

# Conflicts:
#	src/libutil/unix/monitor-fd.hh
2025-03-24 15:48:34 +01:00
John Ericson
e1c559b27a MonitorFdHup: Don't sleep anymore
After the previous commit it should not be necessary. Furthermore, if we
*do* sleep, we'll exacerbate a race condition (in conjunction with
getting rid of the thread cancellation) that will cause test failures.

(cherry picked from commit 49f486d8e0)
2025-03-24 15:48:34 +01:00
Jade Lovelace
ef12785644 daemon: remove workaround for macOS kernel bug that seems fixed
This was filed as https://github.com/nixos/nix/issues/7584, but as far
as I can tell, the previous solution of POLLHUP works just fine on macOS
14. I've also tested on an ancient machine with macOS 10.15.7, which
also has POLLHUP work correctly.

It's possible this might regress some older versions of macOS that have
a kernel bug, but I went looking through the history on the sources and
didn't find anything that looked terribly convincingly like a bug fix
between 2020 and today. If such a broken version exists, it seems pretty
reasonable to suggest simply updating the OS.

Change-Id: I178a038baa000f927ea2cbc4587d69d8ab786843

Based off of commit 69e2ee5b25752ba5fd8644cef56fb9d627ca4a64. Ericson2314 added
additional other information.

(cherry picked from commit 9b3352c3c8)
2025-03-24 15:48:34 +01:00
Félix Baylac Jacqué
cf7d72c733 MonitorFdHup: replace pthread_cancel trick with a notification pipe
On https://github.com/NixOS/nix/issues/8946, we faced a surprising
behaviour wrt. exception when using pthread_cancel. In a nutshell when
a thread is inside a catch block and it's getting pthread_cancel by
another one, then the original exception is bubbled up and crashes the
process.

We now poll on the notification pipe from the thread and exit when the
main thread closes its end. This solution does not exhibit surprising
behaviour wrt. exceptions.

Co-authored-by: Mic92 <joerg@thalheim.io>

Fixes https://github.com/NixOS/nix/issues/8946

See also Lix https://gerrit.lix.systems/c/lix/+/1605 which is very
similar by coincidence. Pulled a comment from that.

(cherry picked from commit 1c636284a3)
2025-03-24 15:48:34 +01:00
John Ericson
336d07397d MonitorFdHup: introduce a num_fds variable
Better than just putting `1` in multiple spots.

(cherry picked from commit cb95791198)
2025-03-24 13:20:56 +00:00
John Ericson
7be9829896 MonitorFdHup: Cleanup a bit with designated initializers
(cherry picked from commit d028bb4c4a)
2025-03-24 13:20:56 +00:00
Jörg Thalheim
a00b385d2a MonitorFdHup: raise explicit SysError rather unreachable
Syscalls can fail for many reasons and we don't want to loose the errno
and error context.

(cherry picked from commit 8e0bc2c3a8)
2025-03-24 13:20:55 +00:00
John Ericson
9883341ea8 monitor-fd.hh: Format
It's a pretty small diff, so let's just start formatting before we make
other changes.

(cherry picked from commit 041394b741)
2025-03-24 13:20:55 +00:00
mergify[bot]
1130be437b
Merge pull request #12684 from NixOS/mergify/bp/2.25-maintenance/pr-12570
Fix macos sandbox issue (backport #12570)
2025-03-19 20:59:01 +00:00
Pierre-Etienne Meunier
7fab0741d8 Fix macos sandbox issue
Co-authored-by: John Ericson <git@JohnEricson.me>

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
(cherry picked from commit 300465c7b8)
2025-03-19 20:21:38 +00:00
mergify[bot]
43286afc8c
Merge pull request #12279 from NixOS/mergify/bp/2.25-maintenance/pr-12258
sequoia-nixbld-user-migration: nail down PATH (backport #12258)
2025-03-12 16:22:54 +00:00
Travis A. Everett
d87e46cfeb sequoia-nixbld-user-migration: nail down PATH
Fixes a user report of trouble with toybox grep and avoids
potential of same basic issue with other utils.

(cherry picked from commit 6a874c2865)
2025-03-12 16:13:35 +00:00
mergify[bot]
40f33b5e17
Merge pull request #12536 from NixOS/mergify/bp/2.25-maintenance/pr-12391
Only try to chmod /nix/var/nix/profiles/per-user when necessary (backport #12391)
2025-02-20 16:53:37 +00:00
Sandro Jäckel
807d186289 Only try to chmod /nix/var/nix/profiles/per-user when necessary
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
(cherry picked from commit dcbf4dcc09)
2025-02-20 16:11:27 +00:00
mergify[bot]
d99bcd62eb
Merge pull request #12529 from NixOS/mergify/bp/2.25-maintenance/pr-12439
Set FD_CLOEXEC on sockets created by curl (backport #12439)
2025-02-19 20:21:40 +00:00
MaxHearnden
a5fa357fdf Set FD_CLOEXEC on sockets created by curl
Curl creates sockets without setting FD_CLOEXEC/SOCK_CLOEXEC, this can
cause connections to remain open forever when using commands like `nix
shell`

This change sets the FD_CLOEXEC flag using a CURLOPT_SOCKOPTFUNCTION
callback.

(cherry picked from commit 12d2527276)
2025-02-19 19:47:45 +00:00
mergify[bot]
9e7663fe38
Merge pull request #12522 from NixOS/mergify/bp/2.25-maintenance/pr-12518
packaging: Restore libgit2 USE_SSH=exec (backport #12518)
2025-02-19 09:18:52 +00:00
Robert Hensing
e2558b8c26 packaging: Restore libgit2 USE_SSH=exec
... when nixpkgs is nixos-unstable or the overlay is used.

(cherry picked from commit 5488e29d2f)
2025-02-19 10:10:45 +01:00
mergify[bot]
9442b9bd7b
Merge pull request #12516 from NixOS/mergify/bp/2.25-maintenance/pr-12484
Support libgit2 1.9.0 (backport #12484)
2025-02-18 23:32:16 +00:00
Robert Hensing
c03bde0133 Support libgit2 1.9.0
For when the overlay is used with nixos-unstable.
1.9.0 has our patches.

(cherry picked from commit b0bbb1252a)
2025-02-19 00:26:46 +01:00
mergify[bot]
d652513e45
Merge pull request #12452 from NixOS/mergify/bp/2.25-maintenance/pr-12448
copyPathToStore(): Preserve symlinks (backport #12448)
2025-02-12 20:00:54 +00:00
Eelco Dolstra
4aba8ad022
Delete unused test 2025-02-12 20:05:02 +01:00
Eelco Dolstra
d856328ab5
Fix build 2025-02-12 20:04:48 +01:00
Eelco Dolstra
9e83b1aa19
Merge pull request #12456 from NixOS/mergify/bp/2.25-maintenance/pr-12450
packaging/components.nix: Don't import a symlink (backport #12450)
2025-02-12 12:48:48 +01:00
Eelco Dolstra
a0fb43e229 Don't import a symlink
This is a workaround to avoid differing evaluation results between Nix
2.19 and >= 2.20 (#12449).

(cherry picked from commit 2e20a5f822)
2025-02-12 11:41:45 +00:00
Eelco Dolstra
7bfd71e10d copyPathToStore(): Preserve symlinks
E.g. in a derivation attribute `foo = ./bar`, if ./bar is a symlink,
we should copy the symlink to the store, not its target. This restores
the behaviour of Nix <= 2.19.

(cherry picked from commit 26b87e78b5)
2025-02-11 21:51:38 +00:00
mergify[bot]
37393f0c69
Merge pull request #12366 from NixOS/mergify/bp/2.25-maintenance/pr-12362
refactor: Extract EvalState::realiseString (backport #12362)
2025-01-27 16:19:54 +00:00
Robert Hensing
7d3021f59f refactor: Extract EvalState::realiseString
(cherry picked from commit 7465fbe926)
2025-01-27 15:51:13 +00:00
mergify[bot]
95253b1f7c
Merge pull request #12358 from NixOS/mergify/bp/2.25-maintenance/pr-12356
Improve "illegal path references in fixed output derivation" error (backport #12356)
2025-01-26 20:12:55 +00:00
Ben Millwood
3fd1316438 Improve "illegal path references in fixed output derivation" error
The main improvement is that the new message gives an example of a path
that is referenced, which should make it easier to track down. While
there, I also clarified the wording, saying exactly why the paths in
question were illegal.

(cherry picked from commit 4e5d1b281e)
2025-01-26 19:38:50 +00:00
Robert Hensing
79a2993e23
Merge pull request #12353 from NixOS/nixfmt-on-2.25
Apply nixfmt (backport 2.25)
2025-01-24 22:41:36 +01:00
Robert Hensing
c69579114b test: Fix shifted source positions after formatting 2025-01-24 22:09:21 +01:00
Robert Hensing
24c78e06cf Format .nix files
This does not include any automation for the release branch, but
is based on the configuration of https://github.com/NixOS/nix/pull/12349

    pre-commit run -a nixfmt-rfc-style
2025-01-24 20:37:38 +01:00
mergify[bot]
566b33b0bd
Merge pull request #12345 from NixOS/mergify/bp/2.25-maintenance/pr-12336
libstore: Fix progress bars (backport #12336)
2025-01-24 11:47:01 +00:00
Philipp Otterbein
6224d87564 libstore: fix progress bars
(cherry picked from commit be97dc1efc)
2025-01-24 11:10:36 +00:00
Eelco Dolstra
636c9cfdf0
Merge pull request #12333 from NixOS/mergify/bp/2.25-maintenance/pr-12331
GitRepo::fetch(): Ignore $GIT_DIR (backport #12331)
2025-01-22 22:04:19 +01:00
Eelco Dolstra
e64fcf62f9 GitRepo::fetch(): Ignore $GIT_DIR
Fixes #12325.

(cherry picked from commit 41983dba8f)
2025-01-22 20:30:25 +00:00
Eelco Dolstra
08d4e67e84 GitRepo::fetch(): Cleanup
(cherry picked from commit bd10b859f7)
2025-01-22 20:30:25 +00:00
Eelco Dolstra
5d2f26e3f6 Bump version 2025-01-22 10:29:21 +01:00
mergify[bot]
132c992ce0
Merge pull request #12319 from NixOS/mergify/bp/2.25-maintenance/pr-12315
tests: Wait for network *online* targets and/or multi-user targets (more) (backport #12315)
2025-01-20 18:28:05 +00:00
Robert Hensing
0284eef493 tests: Wait for network *online* targets
More prevalent than I thought in 15073e86a

See also https://github.com/NixOS/nix/actions/runs/12872412321/job/35887830320?pr=12310
which is a failed github-flakes test without "Network is Online"

(cherry picked from commit 6f0bdd9ae7)

# Conflicts:
#	tests/nixos/nix-docker.nix
2025-01-20 18:16:43 +00:00
Eelco Dolstra
df5246dd8e
Merge pull request #12310 from NixOS/mergify/bp/2.25-maintenance/pr-12302
tests: Wait for network *online* and multi-user targets (backport #12302)
2025-01-20 18:19:24 +01:00
Robert Hensing
8b205302f3 tests: Wait for network *online* and multi-user targets
This should help prevent some test stalls.

By default, multi-user.target does not imply that the network is fully up.

(cherry picked from commit 15073e86a8)
2025-01-20 16:40:04 +00:00
Eelco Dolstra
8e87c19125
Merge pull request #12308 from NixOS/mergify/bp/2.25-maintenance/pr-12294
processGraph(): Don't throw ThreadPoolShutDown if there is an exception (backport #12294)
2025-01-20 17:19:12 +01:00
Eelco Dolstra
c38234bffb
Merge pull request #12300 from NixOS/mergify/bp/2.25-maintenance/pr-12296
addMultipleToStore(): Move pathsToCopy (backport #12296)
2025-01-20 16:26:35 +01:00
Eelco Dolstra
4d0e2b5ade processGraph(): Don't throw ThreadPoolShutDown if there is an exception
Fixes

  $ nix copy --derivation --to /tmp/nix /nix/store/...
  error: cannot enqueue a work item while the thread pool is shutting down

The ThreadPoolShutDown exception was hiding the reason for the thread
pool shut down, e.g.

  error: cannot add path '/nix/store/03sl46khd8gmjpsad7223m32ma965vy9-fix-static.patch' because it lacks a signature by a trusted key

(cherry picked from commit a8c69cc907)
2025-01-20 15:24:55 +00:00
Eelco Dolstra
aabf6e6c65 Add comment
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
(cherry picked from commit 2669e4ac4f)
2025-01-20 14:18:26 +00:00
Eelco Dolstra
7dd6b980aa addMultipleToStore(): Move pathsToCopy
This allows RemoteStore::addMultipleToStore() to free the Source
objects early (and in particular the associated sinkToSource()
buffers). This should fix #7359. For example, memory consumption of

  nix copy --derivation --to ssh-ng://localhost?remote-store=/tmp/nix --derivation --no-check-sigs \
    /nix/store/4p9xmfgnvclqpii8pxqcwcvl9bxqy2xf-nixos-system-...drv

went from 353 MB to 74 MB.

(cherry picked from commit cc838e8181)
2025-01-20 14:18:25 +00:00