- Apr 28, 2020
-
-
Matthew Kenigsberg authored
-
Eelco Dolstra authored
-
- Apr 27, 2020
-
-
Alyssa Ross authored
Suppose I have a path /nix/store/[hash]-[name]/a/a/a/a/a/[...]/a, long enough that everything after "/nix/store/" is longer than 4096 (MAX_PATH) bytes. Nix will happily allow such a path to be inserted into the store, because it doesn't look at all the nested structure. It just cares about the /nix/store/[hash]-[name] part. But, when the path is deleted, we encounter a problem. Nix will move the path to /nix/store/trash, but then when it's trying to recursively delete the trash directory, it will at some point try to unlink /nix/store/trash/[hash]-[name]/a/a/a/a/a/[...]/a. This will fail, because the path is too long. After this has failed, any store deletion operation will never work again, because Nix needs to delete the trash directory before recreating it to move new things to it. (I assume this is because otherwise a path being deleted could already exist in the trash, and then moving it would fail.) This means that if I can trick somebody into just fetching a tarball containing a path of the right length, they won't be able to delete store paths or garbage collect ever again, until the offending path is manually removed from /nix/store/trash. (And even fixing this manually is quite difficult if you don't understand the issue, because the absolute path that Nix says it failed to remove is also too long for rm(1).) This patch fixes the issue by making Nix's recursive delete operation use unlinkat(2). This function takes a relative path and a directory file descriptor. We ensure that the relative path is always just the name of the directory entry, and therefore its length will never exceed 255 bytes. This means that it will never even come close to AX_PATH, and Nix will therefore be able to handle removing arbitrarily deep directory hierachies. Since the directory file descriptor is used for recursion after being used in readDirectory, I made a variant of readDirectory that takes an already open directory stream, to avoid the directory being opened multiple times. As we have seen from this issue, the less we have to interact with paths, the better, and so it's good to reuse file descriptors where possible. I left _deletePath as succeeding even if the parent directory doesn't exist, even though that feels wrong to me, because without that early return, the linux-sandbox test failed. Reported-by:
Alyssa Ross <hi@alyssa.is> Thanks-to: Puck Meerburg <puck@puckipedia.com> Tested-by:
Puck Meerburg <puck@puckipedia.com> Reviewed-by:
Puck Meerburg <puck@puckipedia.com>
-
Matthew Kenigsberg authored
-
Matthew Kenigsberg authored
-
- Apr 25, 2020
-
-
Linus Heckemann authored
Reduces the number of store queries it performs. Also prints a warning if any of the selectors did not match any installed derivations. UX Caveats: - Will print a warning that nothing matched if a previous selector already removed the path - Will not do anything if no selectors were provided (no change from before). Fixes #3531
-
- Apr 22, 2020
-
-
Eelco Dolstra authored
-
Eelco Dolstra authored
(cherry picked from commit c7af247b)
-
- Apr 21, 2020
-
-
Dustin DeWeese authored
-
- Apr 16, 2020
-
-
Ben Burdette authored
-
Eelco Dolstra authored
(cherry picked from commit 8f418473)
-
Eelco Dolstra authored
Usually this just writes to stdout, but for ProgressBar, we need to clear the current line, write the line to stdout, and then redraw the progress bar. (cherry picked from commit 696c0260)
-
Eelco Dolstra authored
-
Ben Burdette authored
-
Eelco Dolstra authored
More #3377.
-
Eelco Dolstra authored
We want to *trace* the 'Value *' arrays, not garbage-collect them! Otherwise the vectors/maps can end up pointing to nowhere. Fixes #3377. Closes #3384.
-
Eelco Dolstra authored
-
Eelco Dolstra authored
-
Domen Kožar authored
-
- Apr 15, 2020
-
-
Ben Burdette authored
-
- Apr 14, 2020
-
-
zimbatm authored
Motivation: maintain project-level configuration files. Document the whole situation a bit better so that it corresponds to the implementation, and add NIX_USER_CONF_FILES that allows overriding which user files Nix will load during startup.
-
- Apr 13, 2020
-
-
Andreas Rammhold authored
Previously the memory would occasionally be collected during eval since the GC doesn't consider the member variable as alive / doesn't scan the region of memory where the pointer lives. By using the traceable_allocator<T> allocator provided by Boehm GC we can ensure the memory isn't collected. It should be properly freed when SourceExprCommand goes out of scope.
-
- Apr 12, 2020
-
-
Daiderd Jordan authored
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 */ };
-
- Apr 11, 2020
-
-
DavHau authored
-
- Apr 10, 2020
-
-
Bruce Toll authored
Temporarily add user-write permission to build directory so that it can be moved out of the sandbox to the store with a .check suffix. This is necessary because the build directory has already had its permissions set read-only, but write permission is required to update the directory's parent link to move it out of the sandbox. Updated the related --check "derivation may not be deterministic" messages to consistently use the real store paths. Added test for non-root sandbox nix-build --check -K to demonstrate issue and help prevent regressions.
-
- Apr 09, 2020
-
-
Bruce Toll authored
With --check and the --keep-failed (-K) flag, the temporary directory was being retained regardless of whether the build was successful and reproducible. This removes the temporary directory, as expected, on a reproducible check build. Added tests to verify that temporary build directories are not retained unnecessarily, particularly when using --check with --keep-failed.
-
Philipp Middendorf authored
-
Domen Kožar authored
-
- Apr 08, 2020
-
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-
Nikola Knezevic authored
-