1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 05:56:03 +01:00
Commit graph

4110 commits

Author SHA1 Message Date
Alexander Bantyev
12935e54ea Mention build users in the 'waiting for' message
(cherry picked from commit 772e5db828)
2023-10-31 12:15:35 +02:00
Alexander Bantyev
849f9b83a8 Don't block while waiting for build users
(cherry picked from commit 14073fb76b)
2023-10-31 12:15:35 +02:00
Alexander Bantyev
a1469cc8f4 Wait for build users when none are available
(cherry picked from commit 880a62b08443a6baa55dab027b69bb8b1551a588)
2023-10-31 12:15:35 +02:00
John Ericson
b4abe56a23 Merge remote-tracking branch 'upstream/2.3-maintenance' into builder-host-key-stable 2023-10-26 16:01:18 -04:00
edef
7f8790eff2 libutil: add ZstdDecompressionSink 2023-10-23 17:36:13 +00:00
Sergei Trofimovich
42b19c7181 src/libutil/json.cc: add missing <cstdint> include for gcc-13
Without the change llvm build fails on this week's gcc-13 snapshot as:

    src/libutil/json.cc: In function 'void nix::toJSON(std::ostream&, const char*, const char*)':
    src/libutil/json.cc:33:22: error: 'uint16_t' was not declared in this scope
       33 |             put(hex[(uint16_t(*i) >> 12) & 0xf]);
          |                      ^~~~~~~~
    src/libutil/json.cc:5:1: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
        4 | #include <cstring>
      +++ |+#include <cstdint>
        5 |

(cherry picked from commit b36d5172cb)
2023-10-19 15:25:34 +01:00
Klemens Nanni
c84e20a296
Fix SO_PEERCRED usage on OpenBSD
getsockopt(2) documents `struct sockpeercred` with `SO_PEERCRED`.
(`struct ucred` does exist, but is incompatible to the Linux version.)
2023-03-11 23:07:19 +04:00
Klemens Nanni
fda598cfdd
Make tar invocation portable, fix OpenBSD build/test
At least on OpenBSD, tar(1) reads from /dev/rst0 not stdin by default
options must specififed consistently with or without dashes, not mixed.

Specify standard input explicitly to not rely on implementation details.
Use either option style consistently.
2023-03-11 23:07:19 +04:00
Klemens Nanni
2dff8c2b40
Include <sys/wait.h> as per wait(4) for WIFEXITED and WEXITSTATUS
Unbreak the build on OpenBSD.
2023-03-11 23:07:19 +04:00
Albert Safin
75bd19758d nix-shell: don't check for "nix-shell" in shebang script name
Without this, moving the nix-shell tests into a `nix-shell` dir breaks
them.

(cherry picked from commit a70706b025)
2021-11-30 05:33:50 +00:00
Arthur Gautier
765332d94b preloadNSS: rework the dns query workaround
backport of https://github.com/NixOS/nix/pull/5384 to nix 2.3
2021-11-25 13:06:00 -08:00
regnat
1aa288c8cf Override socket path with NIX_DAEMON_SOCKET_PATH
This is the first step to testing compatibility with 2.3 in 2.4 and
master.

(adapted from commit 223fbe644a)
2021-11-16 05:44:59 +00:00
Eelco Dolstra
6b17b1677f
Merge pull request #5491 from doronbehar/SQLiteWAL-vfs-backport2.3
libstore: Use unix-dotfile vfs if useSQLiteWAL is false
2021-11-05 13:24:22 +01:00
Fendor
c31ce3dffe PathSubstitutionGoal: Clean up pipe
If there were many top-level goals (which are not destroyed until the
very end), commands like

  $ nix copy --to 'ssh://localhost?remote-store=/tmp/nix' \
    /run/current-system --no-check-sigs --substitute-on-destination

could fail with "Too many open files". So now we do some explicit
cleanup from amDone(). It would be cleaner to separate goals from
their temporary internal state, but that would be a bigger refactor.

Backport 8a29052cb2
2021-11-04 11:26:39 +01:00
Doron Behar
1261a1689b libstore: Use unix-dotfile vfs if useSQLiteWAL is false 2021-11-04 08:10:44 +02:00
Domen Kožar
8c5b39875e
Merge pull request #5054 from alyssais/2.3-host_os
[2.3] Apply OS checks to host platform, not build
2021-09-21 08:12:04 +02:00
Eelco Dolstra
2e80a42c13
Merge pull request #5216 from kvtb/patch-2
`builtins.hashFile`, `builtins.hashString`: realize context before calculation, and discard afterwards
2021-09-13 22:39:26 +02:00
kvtb
7d92204b67
builtins.fetchurl: fix error message
fixes `error: unsupported argument 'path' to 'fetchurl', at 0x1630b48`
2021-09-11 04:54:55 +00:00
Eelco Dolstra
72128074d8
Merge pull request #5228 from baloo/baloo/5089/force-nss_dns-load.2.3.15
preloadNSS: fixup nss_dns load [2.3]
2021-09-09 10:35:49 +02:00
Arthur Gautier
a67dcdd991 preloadNSS: load NSS before threads are started
preloadNSS is not thread-safe, this commit moves it before we start the
first thread.

Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-09-08 18:36:53 +00:00
Arthur Gautier
3d75d87bd3 preloadNSS: fixup nss_dns load
Before this commit, the dns lookup in preloadNSS would still go through
nscd. This did not have the effect of loading the nss_dns.so as expected
(nss_dns.so being out of reach from within the sandbox).

Should LOCALDOMAIN environment variable be defined, nss will completely
avoid nscd and will do its dns resolution on its own.

By temporarly setting LOCALDOMAIN variable before calling in NSS, we can
force NSS to load the shared libraries as expected.

Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-09-07 01:49:37 +00:00
kvtb
f8ccbb40d1
Expr::show(): avoid emiting meaningless chars 2021-09-06 14:29:20 +00:00
kvtb
2b665a311e
hashFile, hashString: realize context before calculation, and discard afterwards 2021-09-05 14:42:06 +00:00
Alyssa Ross
12dc642781
Apply OS checks to host platform, not build
Previously, the build system used uname(1) output when it wanted to
check the operating system it was being built for, which meant that it
didn't take into-account cross-compilation when the build and host
operating systems were different.

To fix this, instead of consulting uname output, we consult the host
triple, specifically the third "kernel" part.

For "kernel"s with stable ABIs, like Linux or Cygwin, we can use a
simple ifeq to test whether we're compiling for that system, but for
other platforms, like Darwin, FreeBSD, or Solaris, we have to use a
more complicated check to take into account the version numbers at the
end of the "kernel"s.  I couldn't find a way to just strip these
version numbers in GNU Make without shelling out, which would be even
more ugly IMO.  Because these checks differ between kernels, and the
patsubst ones are quite fiddly, I've added variables for each host OS
we might want to check to make them easier to reuse.

(cherry picked from commit 4f80464645)
2021-07-27 08:41:57 +00:00
Eelco Dolstra
bd4e03d5fa
Merge pull request #5053 from NixOS/fix-no-such-file-in-chrooted-store
[2.3]: Use the real path when checking imported CA paths
2021-07-27 10:34:29 +02:00
regnat
89fba5c847 Use the real path when checking imported CA paths
Otherwise chrooted store will fail because Nix will try to read the
virtual path instead of the physical one

Should fix https://github.com/NixOS/nixpkgs/issues/126141
2021-07-26 11:34:47 +02:00
Alyssa Ross
fa7cbf8222
Only link with libdl on Linux
Linux is (as far as I know) the only mainstream operating system that
requires linking with libdl for dlopen.  On BSD, libdl doesn't exist,
so on non-FreeBSD BSDs linking will currently fail.  On macOS, it's
apparently just a symlink to libSystem (macOS libc), presumably
present for compatibility with things that assume Linux.

So the right thing to do here is to only add -ldl on Linux, not to add
it for everything that isn't FreeBSD.

(cherry picked from commit c57ab17687)
2021-07-23 10:50:29 +00:00
illustris
1c51a169fb fixed-output derivations: fix incorrect responses for getpwuid
backport of #5006
2021-07-14 14:26:25 +05:30
Emily
76c7f5f215
sandbox: allow SystemVersionCompat.plist on Darwin
For whatever reason, many programs trying to access SystemVersion.plist
also open SystemVersionCompat.plist; this includes Python code and
coreutils’ `cat(1)` (but not the native macOS `/bin/cat`). Illustratory
`dtruss(1m)` output:

    open("/System/Library/CoreServices/SystemVersion.plist\0", 0x0, 0x0)		 = 3 0
    open("/System/Library/CoreServices/SystemVersionCompat.plist\0", 0x0, 0x0)		 = 4 0

I assume this is a Big Sur change relating to the 10.16.x/11.x
version compatibility divide and that it’s something along the lines of
a hook inside libSystem.

Fixes a lot of sandboxed package builds under Big Sur.

(cherry picked from commit 559a504da7)
Signed-off-by: Domen Kožar <domen@dev.si>
2021-07-12 09:35:16 +02:00
Emily
405d78eafc
Mark __impureHostDeps paths as optional
Starting in macOS 11, the on-disk dylib bundles are no longer available,
but nixpkgs needs to be able to keep compatibility with older versions
that require `/usr/lib/libSystem.B.dylib` in `__impureHostDeps`. Allow
it to keep backwards compatibility with these versions by marking these
dependencies as optional.

Fixes #4658.

(cherry picked from commit c4355a52fa)
Signed-off-by: Domen Kožar <domen@dev.si>
2021-07-12 09:30:35 +02:00
Lucas Franceschino
9f7a59af71 Make functionArgs primitive accept primops
(cherry picked from commit b2748c6e99)
2021-06-10 01:00:49 +02:00
regnat
3dbd83b9a1 Check the CA hash when importing stuff in the local store
When adding a path to the local store (via `LocalStore::addToStore`),
ensure that the `ca` field of the provided `ValidPathInfo` does indeed
correspond to the content of the path.
Otherwise any untrusted user (or any binary cache) can add arbitrary
content-addressed paths to the store (as content-addressed paths don’t
need a signature).
2021-06-01 15:21:01 +02:00
Eelco Dolstra
dac86f84c3
Merge pull request #4634 from ianthehenry/backport-user-env-assertion-fix
backport #4411
2021-03-15 16:34:33 +01:00
David McFarland
2fe57daadd Fix insufficent attribute capacity in user profile 2021-03-13 17:32:47 +00:00
Bernardo Meurer
da1629d744
nix-build: set execfail
When starting a nix-shell with `-i` it was previously possible for it to
silently fail in the scenario where the specified interpreter didn't
exist. This happened due to the `exec` call masking the issue.

With this change we enable `execfail`, which causes the script using
`nix-shell` as interpreter to correctly exit with code 127.

Fixes: #4598
(cherry picked from commit 6e849e3b0a)
2021-03-08 02:09:12 -08:00
Graham Christensen
5a2716f6d3
distributed builds: load remote builder host key from the machines file
This is already used by Hydra, and is very useful when materializing
a remote builder list from service discovery. This allows the service
discovery tool to only sync one file instead of two.
2021-02-25 11:11:07 -05:00
Matthew Bauer
f95c320500 Handle missing etag in 304 Not Modified response
GitHub now omits the etag, but 304 implies it matches the one we
provided. Just use that one to avoid having an etag-less resource.

Fixes #4469

(cherry picked from commit a766824660)
2021-01-25 12:18:57 -06:00
Stéphan Kochen
024c0eaad1 Fix compatibility with newer AWS SDKs (#4316)
Tested against AWS SDK 1.8.99. Fixes #3201.

(cherry picked from commit e20a3ec756)
2020-12-26 09:09:21 +00:00
Robert Hensing
c29fffeaaa DerivationGoal: only retry if output closure incomplete is only problem
(cherry picked from commit bd9eb5c743)
2020-12-22 11:46:22 +01:00
Domen Kožar
6de15f722d
Allow HTTP binary cache to request absolute uris 2020-12-16 14:13:15 +01:00
Nikola Knezevic
0f35904915 Add support for \u escape in fromJSON
As fromTOML supports \u and \U escapes, bring fromJSON on par. As JSON defaults
to UTF-8 encoding (every JSON parser must support UTF-8), this change parses the
`\u hex hex hex hex` sequence (\u followed by 4 hexadecimal digits) into an
UTF-8 representation.

Add a test to verify correct parsing, using all escape sequences from json.org.
2020-12-15 18:49:32 +01:00
Nikola Knezevic
b595df5423 Remove redundant check in parseJSONString 2020-12-15 18:48:49 +01:00
Luke Granger-Brown
2239953894 When moving paths out of sandbox, ensure we have write permission.
If we're a single-user installation of Nix, then we won't have root
superpowers to just ignore the permission bits. This means that we'll
need permission on the directory (if it's a directory) that we're moving
in order to move it with rename, because it must update the ".."
directory entry.

Fixes #4295.

This is already working in master, thanks to
e913a2989f (and followup cleanups).
2020-12-04 04:33:33 +00:00
Eelco Dolstra
7f1de4d5ed
Merge pull request #3405 from hercules-ci/issue-3398-path-info-cache-ttls-backport-2.3
pathInfoCache: Respect disk cache TTLs #3398 (2.3 backport)
2020-10-29 12:44:16 +01:00
Eelco Dolstra
f09b375837
Prevent a deadlock when user namespace setup fails
Observed on Centos 7 when user namespaces are disabled:
DerivationGoal::startBuilder() throws an exception, ~DerivationGoal()
waits for the child process to exit, but the child process hangs
forever in drainFD(userNamespaceSync.readSide.get()) in
DerivationGoal::runChild(). Not sure why the SIGKILL doesn't get
through.

Issue #4092.

(cherry picked from commit d761485010)
2020-10-07 09:10:24 +02:00
Daiderd Jordan
f6ff68479e never use /var/folders for TMPDIR on darwin
This doesn't just cause problems for nix-store --serve but also results
in certain build failures. Builds that use unix domain sockets in their
tests often fail because the /var/folders prefix already consumes more
than half of the maximum length of socket paths.

    struct sockaddr_un {
       sa_family_t sun_family;               /* AF_UNIX */
       char        sun_path[108];            /* Pathname */
    };

(cherry picked from commit 4d9db420ff)
2020-09-02 15:41:43 +02:00
Eelco Dolstra
d5c7efae38 repl.cc: Check for HAVE_BOEHMGC
Fixes #3906.

(cherry picked from commit 59067f0f58)
2020-08-13 04:34:36 +02:00
Eelco Dolstra
8b04d28a5b
createUnixDomainSocket(): Fix off-by-one error in copying the socket path
Reported by Kane York.

(cherry picked from commit 2292814049)
2020-07-24 20:50:05 +02:00
Jude Taylor
15876ec4a0 nix auto-gc: use fragment size
(cherry picked from commit e2fc575c61)
2020-07-07 15:40:24 +02:00
Eelco Dolstra
3933cf56af
NAR parser: Fix missing name field check
Discovered by @Kloenk.

(cherry picked from commit 2b834d48aa)
2020-06-30 17:53:17 +02:00