about summary refs log tree commit diff
path: root/src/libutil
AgeCommit message (Collapse)AuthorFilesLines
2018-12-13 probably typovolth1-1/+1
...at least MSVC unable to compile this
2018-11-15 Fix 'Read-only file system' when building a derivationEelco Dolstra2-1/+3
2018-11-13 Restore parent mount namespace before executing a child processEelco Dolstra2-0/+32
This ensures that they can't write to /nix/store. Fixes #2535.
2018-10-31 config: use all of XDG_CONFIG_DIRSLinus Heckemann2-0/+12
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-10-16 RemoteStore: Close connection if an exception occursEelco Dolstra1-1/+5
Fixes #2075.
2018-09-26 sinkToSource(): Start the coroutine lazilyEelco Dolstra1-11/+15
In particular this causes copyStorePath() from HttpBinaryCacheStore to only start a download if needed. E.g. if the destination LocalStore goes to sleep waiting for the path lock and another process creates the path, then LocalStore::addToStore() will never read from the source so we don't have to do the download.
2018-09-26 Make NAR header check more robustEelco Dolstra3-4/+5
Changes std::bad_alloc into bad archive: input doesn't look like a Nix archive
2018-09-17 Fix build failure if parallel xz is not availableEelco Dolstra1-1/+1
2018-09-13 Merge branch 'dirOf-relative' of https://github.com/lheckemann/nixEelco Dolstra1-1/+1
2018-09-04 Get effective user in Nix commandsMatthew Bauer1-1/+1
‘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-21 Improve 'coroutine has finished' error messageEelco Dolstra2-7/+14
2018-08-21 Fix warnings in compression.ccEelco Dolstra1-7/+5
2018-08-13 dirOf: allow use on non-absolute pathsLinus Heckemann1-1/+1
2018-08-06 Fix Brotli decompression in 'nix log'Eelco Dolstra2-325/+244
This didn't work anymore since decompression was only done in the non-coroutine case. Decompressors are now sinks, just like compressors. Also fixed a bug in bzip2 API handling (we have to handle BZ_RUN_OK rather than BZ_OK), which we didn't notice because there was a missing 'throw': if (ret != BZ_OK) CompressionError("error while compressing bzip2 file");
2018-08-06 Require libbrotliEelco Dolstra1-50/+0
2018-07-31 Add a check for broken Boost versionsEelco Dolstra1-0/+4
In some Boost versions, coroutines don't propagate exceptions properly, causing Nix to fail with the exception 'coroutine has finished'.
2018-07-03 Store floating point numbers in double precisionEelco Dolstra1-0/+1
Even on 32-bit systems, Value has enough space to hold a double.
2018-06-18 sync.hh: return cv_status instead of dropping it, in case useful.Will Dietz1-2/+2
2018-05-30 Make <nix/fetchurl.nix> run in constant memoryEelco Dolstra2-0/+19
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-30 Make LocalBinaryCacheStore::narFromPath() run in constant memoryEelco Dolstra2-1/+10
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-05-30 Simplify the callback mechanismEelco Dolstra1-33/+20
2018-05-30 Modularize config settingsEelco Dolstra4-49/+150
Allow global config settings to be defined in multiple Config classes. For example, this means that libutil can have settings and evaluator settings can be moved out of libstore. The Config classes are registered in a new GlobalConfig class to which config files etc. are applied. Relevant to https://github.com/NixOS/nix/issues/2009 in that it removes the need for ad hoc handling of useCaseHack, which was the underlying cause of that issue.
2018-05-21 serialise: fix buffer size used, hide method for internal use onlyWill Dietz2-4/+7
Fixes #2169.
2018-05-02 Fix some random -Wconversion warningsEelco Dolstra4-6/+6
2018-05-02 Fix bzip2 compression of files > 4 GiBEelco Dolstra1-3/+14
Bzip2's 'avail_in' parameter is declared as an unsigned int, so assigning a size_t length to it led to silent truncation. Fixes #2111.
2018-03-22 Fix buildEelco Dolstra1-2/+2
2018-03-22 TweakEelco Dolstra1-1/+1
2018-03-22 Merge branch 'fix/avoid-large-stack-buffers' of https://github.com/dtzWill/nixEelco Dolstra3-20/+21
2018-03-21 Make 'nix copy --from ssh://...' run in constant memoryEelco Dolstra2-0/+20
For instance, this reduced the memory consumption of $ nix copy --from ssh://localhost --to ~/my-nix /nix/store/1n7x0yv8vq6zi90hfmian84vdhd04bgp-blender-2.79a from 632 MiB to 16 MiB.
2018-03-20 Hack to get SSH error messages from build-remoteEelco Dolstra2-5/+22
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-19 serialise.cc: remove pessimising moveWill Dietz1-1/+1
from clang6: src/libutil/serialise.cc:189:23: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
2018-03-19 util: rename stdout/stdin members to avoid conflicts w/standard macroWill Dietz2-9/+9
(cherry picked from commit c389a7fb617ed7bcd617efa68c6a48c00405310d)
2018-03-16 Reduce substitution memory consumptionEelco Dolstra3-1/+87
copyStorePath() now pipes the output of srcStore->narFromPath() directly into dstStore->addToStore(). The sink used by the former is converted into a source usable by the latter using boost::coroutine2. This is based on [1]. This reduces the maximum resident size of $ nix build --store ~/my-nix/ /nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1 --substituters file:///tmp/binary-cache-xz/ --no-require-sigs from 418592 KiB to 53416 KiB. (The previous commit also reduced the runtime from ~4.2s to ~3.4s, not sure why.) A further improvement will be to download files into a Sink. [1] https://github.com/NixOS/nix/compare/master...Mathnerd314:dump-fix-coroutine#diff-dcbcac55a634031f9cc73707da6e4b18 Issue #1969.
2018-03-16 decompress(): Use a Source and SinkEelco Dolstra5-75/+198
This allows decompression to happen in O(1) memory.
2018-03-15 Filter ANSI colors when not writing to a terminalEelco Dolstra3-7/+9
Fixes https://github.com/NixOS/nixpkgs/issues/37114.
2018-03-15 Merge pull request #1965 from masaeedu/masterEelco Dolstra2-6/+16
Wrap thread local in function for Cygwin
2018-03-14 Catch more possible instances of passing NULL to memcpy.Shea Levy1-0/+1
Actually fixes #1976.
2018-03-12 Wrap thread local in function for CygwinAsad Saeeduddin2-6/+16
Fixes #1826. See #1352 for a previous instance of a similar change.
2018-03-09 Fix double free in Store::queryPathInfo()Eelco Dolstra1-4/+4
It was holding on to a Value* (i.e. a std::shared_ptr<ValidPathInfo>*) outside of the pathInfoCache lock, so the std::shared_ptr could be destroyed between the release of the lock and the decrement of the std::shared_ptr refcount. This can happen if more than 'path-info-cache-size' paths are added in the meantime, *or* if clearPathInfoCache() is called. The hydra-queue-runner queue monitor thread periodically calls the later, so is likely to trigger a crash. Fixes https://github.com/NixOS/hydra/issues/542.
2018-03-06 logging: Don't throw from Activity destructorWill Dietz2-2/+9
Move definition of destructor to logging.cc for access to util.hh's ignoreException.
2018-03-02 don't allocate large buffers on the stackWill Dietz3-23/+24
2018-03-02 Merge branch 'write-failure-fixes' of git://github.com/lheckemann/nixShea Levy1-1/+2
2018-02-26 nix run: Fix segfault on macOSEelco Dolstra2-0/+10
Note that clearenv() is not available on macOS. Fixes #1907.
2018-02-19 libutil: Fix invalid assert on decoding base64 hashesTuomas Tynkkynen1-1/+2
The assertion is broken because there is no one-to-one mapping from length of a base64 string to the length of the output. E.g. "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9q=" results in a 32-byte output. "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9qy" results in a 33-byte output. To reproduce, evaluate: builtins.derivationStrict { name = "0"; builder = "0"; system = "0"; outputHashAlgo = "sha256"; outputHash = "1q69lz7Empb06nzfkj651413n9icx0njmyr3xzq1j9qy"; } Found by afl-fuzz.
2018-02-19 libutil: Fix infinite loop in filterANSIEscapes on '\r'Tuomas Tynkkynen1-1/+1
E.g. nix-instantiate --eval -E 'abort "\r"' hangs. Found by afl-fuzz.
2018-02-19 Config::handleUnknownSettings(): Remove unused 'fatal' argumentEelco Dolstra2-6/+3
2018-02-19 Merge branch 'register-settings' of https://github.com/shlevy/nixEelco Dolstra2-25/+25
2018-02-19 Merge pull request #1857 from dtzWill/fix/check-for-lzma-mtEelco Dolstra1-23/+37
configure.ac: check if lzma has MT support, fix deb build/etc.
2018-02-14 monitor-fds: Fix on macOS.Shea Levy1-7/+23
Fixes #1871.
2018-02-13 Allow plugins to define new settings.Shea Levy2-25/+25