Commit graph

11245 commits

Author SHA1 Message Date
Robert Hensing
ffc1b30f50 refact: Extract build-utils-meson/libatomic 2024-11-07 11:40:02 +01:00
Robert Hensing
388271e8ec initRepoAtomically: Catch directory_not_empty 2024-11-06 23:52:48 +01:00
John Ericson
e70c9bb06a Remove old build system 2024-11-06 16:09:18 -05:00
John Ericson
ba34ea9fe7 Add missing deps to the dev shell 2024-11-06 16:09:18 -05:00
Robert Hensing
3112e59734 ProgressBar::ask: Accept EOF as a no
This may occur when stderr is a tty but stdin is empty.
E.g.

    $ nix build </dev/null
    error: unexpected EOF reading a line

These stdio handles are how some non-interactive sandboxes behave,
including the Nix build sandbox and Hercules CI Effects.
2024-11-06 19:45:19 +01:00
Robert Hensing
f7b1e535a3 nix::readLine: Add eofOk parameter 2024-11-06 14:42:51 +01:00
Sergei Zimmerman
2e7466a4e0 fix(libutil-tests/nix_api_util): get rid of unnecessary memory leaks 2024-11-06 10:55:39 +03:00
Jörg Thalheim
2ef5e222df
Merge pull request #11813 from xokdvium/dev/fix-use-after-free-libstore-tests
fix(libstore-tests): remove use-after-free bug for `StringSource`
2024-11-06 06:48:20 +01:00
John Ericson
bf19e5c34b
Merge pull request #11803 from obsidiansystems/factor-out-dev-shell
Dev shell improvements
2024-11-05 23:58:52 -05:00
Sergei Zimmerman
5bc8957c73 fix(libstore-tests): remove use-after-free bug for StringSource
Unfortunately `StringSource` class is very easy was very easy to misuse
because the ctor took a plain `std::string_view` which has a bad habit
of being implicitly convertible from an rvalue `std::string`. This lead
to unintentional use-after-free bugs.

This patch makes `StringSource` much harder to misuse by disabling the ctor
from a `std::string &&` (but `const std::string &` is ok).

Fix affected tests from libstore-tests.
Reformat those tests with clangd's range formatting since the diff is tiny
and it seems appropriate.
2024-11-06 02:28:21 +03:00
John Ericson
dfd0033afb
Merge pull request #11809 from nix-windows/windows-build/meson-fixes
Meson fixes for msys2 builds
2024-11-05 10:46:03 -05:00
Brian McKenna
c25967384f msys2: link in wsock32 in libstore 2024-11-06 00:18:59 +11:00
Brian McKenna
f1fd277f1e msys2: make symbolic linking work in Meson 2024-11-06 00:18:58 +11:00
Brian McKenna
9dca7aeece Set Windows API version in Meson 2024-11-05 23:36:08 +11:00
John Ericson
26ea905312 Include more deps for the dev shell
When we get rid of the make build system, we would be missing things.
Incuding these packages' deps ensure we don't miss things.
2024-11-04 15:48:08 -05:00
Bryan Honof
c800f3fa93
chore: run formatters 2024-11-04 14:41:40 +01:00
Bryan Honof
affd2dbc6c
test(functional): add tests for new environment operation flags 2024-11-04 14:41:33 +01:00
Bryan Honof
0b790b4849
feat: add flag set-env-var to MixEnvironment 2024-11-04 14:02:29 +01:00
Eelco Dolstra
655bfa6b59
Merge pull request #11797 from nix-windows/windows-build/eval-error
Fix compilation of eval under Windows
2024-11-04 13:37:16 +01:00
Brian McKenna
d711c7e965 Fix compilation of eval under Windows 2024-11-04 19:32:41 +11:00
Brian McKenna
7b7e8a3307 Fix compilation of nix-build on Windows 2024-11-04 11:53:49 +11:00
Eelco Dolstra
7362987182 Merge remote-tracking branch 'nix-ghsa-wf4c-57rh-9pjg/advisory-fix-1' 2024-10-30 21:40:14 +01:00
Robert Hensing
64744503cc Tidy 2024-10-30 01:08:01 +01:00
Robert Hensing
760be5fe1e refact: Extract derivationToValue 2024-10-30 01:06:51 +01:00
Robert Hensing
5f691206ba refact: Extract scopedImport 2024-10-30 01:06:45 +01:00
Artemis Tosini
d023202811
Add support for utimensat as an alternative to lutimes
OpenBSD doesn't support `lutimes`, but does support `utimensat` which
subsumes it. In fact, all the BSDs, Linux, and newer macOS all support
it. So lets make this our first choice for the implementation.

In addition, let's get rid of the `lutimes` `ENOSYS` special case. The
Linux manpage says

> ENOSYS
>
> The kernel does not support this call; Linux 2.6.22 or later is
> required.

which I think is the origin of this check, but that's a very old version
of Linux at this point. The code can be simplified a lot of we drop
support for it here (as we've done elsewhere, anyways).

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
2024-10-26 18:02:24 +00:00
Eelco Dolstra
7b7a61b3d7
Merge pull request #11726 from Mic92/warn-large-threshold
warn-large-path-threshold: define 0 as number to disable warnings
2024-10-23 13:41:28 +02:00
Jörg Thalheim
e1834f4caa warn-large-path-threshold: define 0 as number to disable warnings
the default int64_t max was still overflowing for me, when this was dumped as json (noticed during building the manual).
So making 0, the default and define it as "no warnings" fixes the situtation.
Also it's much more human-readable in documentation.
2024-10-22 18:23:19 +02:00
Robert Hensing
d1e0bae55a local-derivation-goal: Move builder preparation to non-builtin code path 2024-10-22 15:30:03 +02:00
Robert Hensing
766263d53a Fix meson build on darwin
std::stringbuf is defined in <sstream>
2024-10-22 15:30:03 +02:00
Robert Hensing
06e27042e1 local-derivation-goal: Refactor
This works because the `builder` and `args` variables are only used
in the non-builtin code path.

Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 15:30:03 +02:00
Robert Hensing
14d09e0b55 local-derivation-goal: Print sandbox error detail on darwin
Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 15:30:03 +02:00
Robert Hensing
f733553061 packaging: Add darwin -lsandbox in meson 2024-10-22 15:30:03 +02:00
Puck Meerburg
d2c880b03f fix: Run all derivation builders inside the sandbox on macOS 2024-10-22 15:30:03 +02:00
Eelco Dolstra
eaae19403d
Merge pull request #11706 from ivan-tkatchev/fix-11704
nix shell/run: Use overlayfs
2024-10-22 14:17:28 +02:00
Eelco Dolstra
c2cf01a21e
Merge pull request #11713 from Mic92/env-vars
fix env-vars beeing written to `/tmp`
2024-10-22 14:12:36 +02:00
Jörg Thalheim
2105574702 fix env-vars beeing written to /tmp
This overall seems like insecure tmp file handling to me. Because other
users could replace files in /tmp with a symlink and make the nix-shell
override other files.

fixes https://github.com/NixOS/nix/issues/11470
2024-10-22 08:21:18 +00:00
Jörg Thalheim
48a7ac23bc make doxygen build more silent
The buildoutput of doxygen often hides important build warnings and
errors behind a wall of text.
2024-10-22 09:53:49 +02:00
tomberek
63e6672251
Merge pull request #11723 from roberth/doc-tryEval
doc: Explain why tryEval does not return the message
2024-10-21 08:33:07 -04:00
Robert Hensing
90d257b771 doc: Explain why tryEval does not return the message 2024-10-20 19:31:16 +02:00
Sergei Zimmerman
8277b50b6f fix(nix/eval.cc): move call to fs::create_directory out of assert
If the call is inside the assertion, then in non-assert builds
the call would be stripped out. This is highly unexpected.
2024-10-19 00:40:14 +03:00
John Ericson
e65510da56 Move unit tests to the location Meson expects them to be
Everything that is a separate subproject should live in the subprojects
directory.

Progress on #2503

This reverts commit 451f8a8c19.
2024-10-17 15:42:16 -04:00
Robert Hensing
f51974d698
Merge pull request #11665 from roberth/fix-Interrupted-falling-out-of-thread
Fix `Interrupted` falling out of thread crash
2024-10-16 20:09:29 +02:00
Robert Hensing
ed184f0b61
Typo
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2024-10-16 19:40:45 +02:00
Eelco Dolstra
facc502bc8
Merge pull request #11695 from DeterminateSystems/override-lastModified
path fetcher: Allow the lastModified attribute to be overriden again
2024-10-16 18:03:29 +02:00
Robert Hensing
fd8a4a86d9 ThreadPool: don't silently ignore non-std exceptions
Introduced in 8f6b347abd without explanation.

Throwing anything that's not that is a programming mistake that we don't want
to ignore silently. A crash would be ok, because that means we/they can fix
the offending throw.
2024-10-16 17:56:08 +02:00
Robert Hensing
16320f6d24 Handle ThreadPoolShutdown with normal catch 2024-10-16 17:56:08 +02:00
Robert Hensing
3f9ff10786 ThreadPool: catch Interrupted 2024-10-16 17:56:08 +02:00
Robert Hensing
de41e46175 Document recursive-nix startDaemon/stopDaemon 2024-10-16 17:56:08 +02:00
Robert Hensing
0e5a5303ad fix: Ignore Interrupted in recursive-nix daemon worker
Otherwise, if checkInterrupt() in any of the supported store operations
would catch onto a user interrupt, the exception would bubble to the thread
start and be handled by std::terminate(): a crash.
2024-10-16 17:56:08 +02:00