aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
AgeCommit message (Collapse)Author
2019-05-12runProgram: Uncomment chdir supportGraham Christensen
2019-05-12runProgram: support gid, uid, chdirGraham Christensen
2019-05-12diff hook: execute as the build user, and pass the temp dirGraham Christensen
2019-05-03Fix "Bad system call" running i686-linux binaries on x86_64-linuxEelco Dolstra
To determine which seccomp filters to install, we were incorrectly using settings.thisSystem, which doesn't denote the actual system when --system is used. Fixes #2791.
2019-03-14experimental/optional -> optionalEelco Dolstra
2019-02-05Revert "Restore parent mount namespace before executing a child process"Eelco Dolstra
This reverts commit a0ef21262f4d5652bfb65cfacaec01d89c475a93. This doesn't work in 'nix run' and nix-shell because setns() fails in multithreaded programs, and Boehm GC mark threads are uncancellable. Fixes #2646.
2018-12-13probably typovolth
...at least MSVC unable to compile this
2018-11-15Fix 'Read-only file system' when building a derivationEelco Dolstra
2018-11-13Restore parent mount namespace before executing a child processEelco Dolstra
This ensures that they can't write to /nix/store. Fixes #2535.
2018-10-31config: use all of XDG_CONFIG_DIRSLinus Heckemann
Previously, config would only be read from XDG_CONFIG_HOME. This change allows reading config from additional directories, which enables e.g. per-project binary caches or chroot stores with the help of direnv.
2018-09-13Merge branch 'dirOf-relative' of https://github.com/lheckemann/nixEelco Dolstra
2018-09-04Get effective user in Nix commandsMatthew Bauer
‘geteuid’ gives us the user that the command is being run as, including in setuid modes. By using geteuid to determind id, we can avoid the ‘sudo -i’ hack when upgrading Nix. So now, upgrading Nix on macOS is as simple as: $ sudo nix-channel --update $ sudo nix-env -u $ sudo launchctl stop org.nixos.nix-daemon $ sudo launchctl start org.nixos.nix-daemon or $ sudo systemctl restart nix-daemon
2018-08-13dirOf: allow use on non-absolute pathsLinus Heckemann
2018-05-30Make <nix/fetchurl.nix> run in constant memoryEelco Dolstra
E.g. nix-build --store ~/my-nix/ -E 'import <nix/fetchurl.nix> { url = https://cache.nixos.org/nar/0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv.nar.xz; sha256 = "0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv"; }' now runs in 17 MiB (was 70 MiB), while nix-build --store ~/my-nix/ -E 'import <nix/fetchurl.nix> { url = https://cache.nixos.org/nar/0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv.nar.xz; sha256 = "0d2fxljdih3nc5dqx41hjzic3141ajil94m8kdbpryq569dpsbvb"; unpack = true; }' runs in 17 MiB (was 346 MiB).
2018-05-30Make LocalBinaryCacheStore::narFromPath() run in constant memoryEelco Dolstra
This reduces memory consumption of nix copy --from file://... --to ~/my-nix /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 514 MiB to 18 MiB for an uncompressed binary cache, and from 192 MiB to 53 MiB for a bzipped binary cache. It may also be faster because fetching can happen concurrently with decompression/writing. Continuation of 48662d151bdf4a38670897beacea9d1bd750376a. Issue https://github.com/NixOS/nix/issues/1681.
2018-03-22Merge branch 'fix/avoid-large-stack-buffers' of https://github.com/dtzWill/nixEelco Dolstra
2018-03-20Hack to get SSH error messages from build-remoteEelco Dolstra
E.g. cannot build on 'ssh://mac1': cannot connect to 'mac1': bash: nix-store: command not found cannot build on 'ssh://mac2': cannot connect to 'mac2': Host key verification failed. cannot build on 'ssh://mac3': cannot connect to 'mac3': Received disconnect from 213... port 6001:2: Too many authentication failures Authentication failed.
2018-03-19util: rename stdout/stdin members to avoid conflicts w/standard macroWill Dietz
(cherry picked from commit c389a7fb617ed7bcd617efa68c6a48c00405310d)
2018-03-16decompress(): Use a Source and SinkEelco Dolstra
This allows decompression to happen in O(1) memory.
2018-03-15Filter ANSI colors when not writing to a terminalEelco Dolstra
Fixes https://github.com/NixOS/nixpkgs/issues/37114.
2018-03-02don't allocate large buffers on the stackWill Dietz
2018-02-26nix run: Fix segfault on macOSEelco Dolstra
Note that clearenv() is not available on macOS. Fixes #1907.
2018-02-19libutil: Fix infinite loop in filterANSIEscapes on '\r'Tuomas Tynkkynen
E.g. nix-instantiate --eval -E 'abort "\r"' hangs. Found by afl-fuzz.
2018-02-07Improve filtering of ANSI escape sequences in build logsEelco Dolstra
All ANSI sequences except color setting are now filtered out. In particular, terminal resets (such as from NixOS VM tests) are filtered out. Also, fix the completely broken tab character handling.
2018-01-16Add pure evaluation modeEelco Dolstra
In this mode, the following restrictions apply: * The builtins currentTime, currentSystem and storePath throw an error. * $NIX_PATH and -I are ignored. * fetchGit and fetchMercurial require a revision hash. * fetchurl and fetchTarball require a sha256 attribute. * No file system access is allowed outside of the paths returned by fetch{Git,Mercurial,url,Tarball}. Thus 'nix build -f ./foo.nix' is not allowed. Thus, the evaluation result is completely reproducible from the command line arguments. E.g. nix build --pure-eval '( let nix = fetchGit { url = https://github.com/NixOS/nixpkgs.git; rev = "9c927de4b179a6dd210dd88d34bda8af4b575680"; }; nixpkgs = fetchGit { url = https://github.com/NixOS/nixpkgs.git; ref = "release-17.09"; rev = "66b4de79e3841530e6d9c6baf98702aa1f7124e4"; }; in (import (nix + "/release.nix") { inherit nix nixpkgs; }).build.x86_64-linux )' The goal is to enable completely reproducible and traceable evaluation. For example, a NixOS configuration could be fully described by a single Git commit hash. 'nixos-rebuild' would do something like nix build --pure-eval '( (import (fetchGit { url = file:///my-nixos-config; rev = "..."; })).system ') where the Git repository /my-nixos-config would use further fetchGit calls or Git externals to fetch Nixpkgs and whatever other dependencies it has. Either way, the commit hash would uniquely identify the NixOS configuration and allow it to reproduced.
2017-11-20CleanupEelco Dolstra
2017-11-20Merge pull request #1645 from twhitehead/stat-raceEelco Dolstra
Fix (highly unlikely) race condition in readLink
2017-11-01fetchMercurial: Don't fetch hashes we already haveEelco Dolstra
2017-10-30Fix (highly unlikely) race condition in readLinkTyson Whitehead
Used to determine symlink size with stat and value with readlink. This could technically result in garbage if symlink changed between calls. Also gets around the broken stat implementation in our network filesystem (returns size + 1 giving a byte of garbage).
2017-10-25Pass lists/attrsets to bash as (associative) arraysEelco Dolstra
2017-09-08ThreadPool: On exception, interrupt the other worker threadsEelco Dolstra
2017-08-29readLink(): Handle symlinks in /procEelco Dolstra
Symlinks like /proc/self/exe report a stat() size of 0, so use a buffer of at least PATH_MAX instead.
2017-08-25Handle SIGWINCHEelco Dolstra
2017-08-25TypoEelco Dolstra
2017-08-18Remove unused decodeOctalEscapedAndy Wingo
Besides being unused, this function has a bug that it will incorrectly decode the path component Ubuntu\04016.04.2\040LTS\040amd64 as "Ubuntu.04.2 LTS amd64" instead of "Ubuntu 16.04.2 LTS amd64".
2017-08-09Use /proc/self/fd to efficiently close all FDs on LinuxEelco Dolstra
Issue #1506.
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-11replaceSymlink(): Handle the case where the temporary file already existsEelco Dolstra
Not really necessary anymore for #849, but still nice to have.
2017-06-12Suppress spurious "killing process N: Operation not permitted" on macOSEelco Dolstra
2017-05-16Improve progress indicatorEelco Dolstra
2017-05-05Figure out the user's home directory if $HOME is not setEelco Dolstra
2017-05-01Minor cleanupEelco Dolstra
2017-04-25nix repl: Use $XDG_DATA_HOME for the readline historyEelco Dolstra
2017-04-21add helper function to set 'interruptThrown'David McFarland
this fixes a linker failure on cygwin 64 due to some bad interaction between tls and shared libraries. see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697
2017-04-20Read per-user settings from ~/.config/nix/nix.confEelco Dolstra
2017-04-13canonPath(): Check against empty pathsEelco Dolstra
2017-04-06Fix bogus "unexpected Nix daemon error: interrupted by the user"Eelco Dolstra
2017-03-16Remove "killing process <pid>" messagesEelco Dolstra
They convey no useful information.
2017-03-15runProgram(): Distinguish between empty input and no inputEelco Dolstra
For example, if we call brotli with an empty input, it shouldn't read from the caller's stdin.
2017-03-15Fix deadlock in runProgram() when input is larger than the pipe buffer sizeEelco Dolstra