aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
AgeCommit message (Collapse)Author
2017-11-01fetchMercurial: Don't fetch hashes we already haveEelco Dolstra
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
2017-02-16Support netrc in <nix/fetchurl.nix>Eelco Dolstra
This allows <nix/fetchurl.nix> to fetch private Git/Mercurial repositories, e.g. import <nix/fetchurl.nix> { url = https://edolstra@bitbucket.org/edolstra/my-private-repo/get/80a14018daed.tar.bz2; sha256 = "1mgqzn7biqkq3hf2697b0jc4wabkqhmzq2srdymjfa6sb9zb6qs7"; } where /etc/nix/netrc contains: machine bitbucket.org login edolstra password blabla... This works even when sandboxing is enabled. To do: add unpacking support (i.e. fetchzip functionality).
2017-02-08Include config.h implicitly with '-include config.h' in CFLAGSTuomas Tynkkynen
Because config.h can #define things like _FILE_OFFSET_BITS=64 and not every compilation unit includes config.h, we currently compile half of Nix with _FILE_OFFSET_BITS=64 and other half with _FILE_OFFSET_BITS unset. This causes major havoc with the Settings class on e.g. 32-bit ARM, where different compilation units disagree with the struct layout. E.g.: diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc @@ -166,6 +166,8 @@ void Settings::update() _get(useSubstitutes, "build-use-substitutes"); + fprintf(stderr, "at Settings::update(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); _get(buildUsersGroup, "build-users-group"); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -138,6 +138,8 @@ void RemoteStore::initConnection(Connection & conn) void RemoteStore::setOptions(Connection & conn) { + fprintf(stderr, "at RemoteStore::setOptions(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); conn.to << wopSetOptions Gave me: at Settings::update(): &useSubstitutes = 0xb6e5c5cb at RemoteStore::setOptions(): &useSubstitutes = 0xb6e5c5c7 That was not a fun one to debug!
2017-02-01Restore default signal handling in child processesEelco Dolstra
In particular, this fixes Ctrl-C in nix-shell sessions.
2017-01-26Fix interrupt handlingEelco Dolstra
2017-01-24Work around a bug in clang and older versions of gccEelco Dolstra
http://hydra.nixos.org/build/46597440 https://llvm.org/bugs/show_bug.cgi?id=28096
2017-01-19Kill builds when we get EOF on the log FDEelco Dolstra
This closes a long-time bug that allowed builds to hang Nix indefinitely (regardless of timeouts) simply by doing exec > /dev/null 2>&1; while true; do true; done Now, on EOF, we just send SIGKILL to the child to make sure it's really gone.
2017-01-17Handle SIGINT etc. via a sigwait() signal handler threadEelco Dolstra
This allows other threads to install callbacks that run in a regular, non-signal context. In particular, we can use this to signal the downloader thread to quit. Closes #1183.
2017-01-16AutoCloseDir: Use std::unique_ptrEelco Dolstra
2017-01-16AutoDeleteArray -> std::unique_ptrEelco Dolstra
Also, switch to C++14 for std::make_unique.
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-10-12Add some functions needed by hydraEelco Dolstra
2016-10-06Merge pull request #998 from veprbl/rx_chmod_fixEelco Dolstra
override rx directory permissions in deletePath()
2016-09-21nix-build, nix-shell: Don't print error message if nix-store/nix-instantiate ↵Eelco Dolstra
fails
2016-09-21printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra
2016-09-21Some notational convenience for formatting stringsEelco Dolstra
We can now write throw Error("file '%s' not found", path); instead of throw Error(format("file '%s' not found") % path); and similarly printError("file '%s' not found", path); instead of printMsg(lvlError, format("file '%s' not found") % path);
2016-09-20TweakEelco Dolstra
2016-09-20nix-shell: Fix $PATH handling in the impure caseEelco Dolstra
We were passing "p=$PATH" rather than "p=$PATH;", resulting in some invalid shell code. Also, construct a separate environment for the child rather than overwriting the parent's.
2016-09-16Make computeFSClosure() single-threaded againEelco Dolstra
The fact that queryPathInfo() is synchronous meant that we needed a thread for every concurrent binary cache lookup, even though they end up being handled by the same download thread. Requiring hundreds of threads is not a good idea. So now there is an asynchronous version of queryPathInfo() that takes a callback function to process the result. Similarly, enqueueDownload() now takes a callback rather than returning a future. Thus, a command like nix path-info --store https://cache.nixos.org/ -r /nix/store/slljrzwmpygy1daay14kjszsr9xix063-nixos-16.09beta231.dccf8c5 that returns 4941 paths now takes 1.87s using only 2 threads (the main thread and the downloader thread). (This is with a prewarmed CloudFront.)
2016-09-16printMsg(): Don't check for interruptsEelco Dolstra
Having the logger function potentially throw exceptions is Heisenbuggy.
2016-09-14Add a toLower utility functionEelco Dolstra
2016-09-14Move some .drv parsing functions out of utilEelco Dolstra
2016-07-25override rx directory permissions in deletePath()Dmitry Kalinkin
This fixes instantiation of pythonPackages.pytest that produces a directory with less permissions during one of it's tests that leads to a nix error like: error: opening directory ‘/tmp/nix-build-python2.7-pytest-2.9.2.drv-0/pytest-of-user/pytest-0/testdir/test_cache_failure_warns0/.cache’: Permission denied
2016-07-11Modernize AutoCloseFDShea Levy
2016-06-09Use O_CLOEXEC in most placesEelco Dolstra
2016-06-02createTempDir(): Don't do a chown on LinuxEelco Dolstra
It's not needed and can cause problems in a user namespace.
2016-04-29Support Git repos in the Nix pathEelco Dolstra
E.g. $ nix-build -I nixpkgs=git://github.com/NixOS/nixpkgs '<nixpkgs>' -A hello This is not extremely useful yet because you can't specify a branch/revision.
2016-04-25Improved logging abstractionEelco Dolstra
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.