aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
AgeCommit message (Collapse)Author
2014-12-10Revert "Use posix_spawn to run the pager"Eelco Dolstra
This reverts commit d34d2b2bbf784c0bb420a50905af25e02c6e4989.
2014-12-05Use posix_spawn to run the pagerEelco Dolstra
In low memory environments, "nix-env -qa" failed because the fork to run the pager hit the kernel's overcommit limits. Using posix_spawn gets around this. (Actually, you have to use posix_spawn with the undocumented POSIX_SPAWN_USEVFORK flag, otherwise it just uses fork/exec...)
2014-11-25Add a primop for regular expression pattern matchingEelco Dolstra
The function ‘builtins.match’ takes a POSIX extended regular expression and an arbitrary string. It returns ‘null’ if the string does not match the regular expression. Otherwise, it returns a list containing substring matches corresponding to parenthesis groups in the regex. The regex must match the entire string (i.e. there is an implied "^<pat>$" around the regex). For example: match "foo" "foobar" => null match "foo" "foo" => [] match "f(o+)(.*)" "foooobar" => ["oooo" "bar"] match "(.*/)?([^/]*)" "/dir/file.nix" => ["/dir/" "file.nix"] match "(.*/)?([^/]*)" "file.nix" => [null "file.nix"] The following example finds all regular files with extension .nix or .patch underneath the current directory: let findFiles = pat: dir: concatLists (mapAttrsToList (name: type: if type == "directory" then findFiles pat (dir + "/" + name) else if type == "regular" && match pat name != null then [(dir + "/" + name)] else []) (readDir dir)); in findFiles ".*\\.(nix|patch)" (toString ./.)
2014-11-19nix-daemon: Call exit(), not _exit()Eelco Dolstra
This was preventing destructors from running. In particular, it was preventing the deletion of the temproot file for each worker process. It may also have been responsible for the excessive WAL growth on Hydra (due to the SQLite database not being closed properly). Apparently broken by accident in 8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74.
2014-10-20Fix build on gcc < 4.7Shea Levy
2014-10-20Revert "Drop support for pre-c++11 compilers."Shea Levy
The breakage this fixed can be worked around without removing support. This reverts commit 84a13dc576496f1227665259c61f86184f452f51.
2014-10-18Drop support for pre-c++11 compilers.Shea Levy
In particular, gcc 4.6's std::exception::~exception has an exception specification in c++0x mode, which requires us to use that deprecated feature in nix (and led to breakage after some recent changes that were valid c++11). nix already uses several c++11 features and gcc 4.7 has been around for over 2 years.
2014-10-03Remove some duplicate codeEelco Dolstra
2014-10-03nix-env: Add regular expression support in selectorsEelco Dolstra
So you can now do things like: $ nix-env -qa '.*zip.*' $ nix-env -qa '.*(firefox|chromium).*'
2014-10-03createDirs(): Handle ‘path’ being a symlinkEelco Dolstra
In particular, this fixes "nix-build -o /tmp/result" on Mac OS X (where /tmp is a symlink).
2014-09-19Remove bogus commentEelco Dolstra
2014-08-21Use PR_SET_PDEATHSIG to ensure child cleanupEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-20Add some colorEelco Dolstra
2014-08-20nix-store -l: Automatically pipe output into $PAGEREelco Dolstra
2014-08-04Get rid of "killing <pid>" message for unused build hooksEelco Dolstra
2014-08-01Call commonChildInit() before doing chroot initEelco Dolstra
This ensures that daemon clients see error messages from the chroot setup.
2014-08-01Eliminate redundant copyEelco Dolstra
2014-08-01Make readDirectory() return inode / file typeEelco Dolstra
2014-07-31Restore default SIGPIPE handler before invoking ‘man’Eelco Dolstra
Fixes NixOS/nixpkgs#3410.
2014-07-24Use pthread_cancel instead of a signalEelco Dolstra
Signal handlers are process-wide, so sending SIGINT to the monitor thread will cause the normal SIGINT handler to run. This sets the isInterrupted flag, which is not what we want. So use pthread_cancel instead.
2014-07-24Fix bogus pass by referenceEelco Dolstra
http://hydra.nixos.org/build/12711659
2014-07-24More debuggingEelco Dolstra
2014-07-24Add some assertionsEelco Dolstra
2014-07-23nix-daemon: Simplify stderr handlingEelco Dolstra
2014-07-23nix-daemon: Use a thread instead of SIGPOLL to catch client disconnectsEelco Dolstra
The thread calls poll() to wait until a HUP (or other error event) happens on the client connection. If so, it sends SIGINT to the main thread, which is then cleaned up normally. This is much nicer than messing around with SIGPOLL.
2014-07-23startProcess: Make writing error messages from the child more robustEelco Dolstra
2014-07-18Better fix for strcasecmp on DarwinEelco Dolstra
2014-07-17Ugly hack to fix building on old DarwinEelco Dolstra
http://hydra.nixos.org/build/12580878
2014-07-16Get rid of a compiler warningEelco Dolstra
2014-07-16Be more strict about file names in NARsEelco Dolstra
2014-07-16Handle case collisions on case-insensitive systemsEelco Dolstra
When running NixOps under Mac OS X, we need to be able to import store paths built on Linux into the local Nix store. However, HFS+ is usually case-insensitive, so if there are directories with file names that differ only in case, then importing will fail. The solution is to add a suffix ("~nix~case~hack~<integer>") to colliding files. For instance, if we have a directory containing xt_CONNMARK.h and xt_connmark.h, then the latter will be renamed to "xt_connmark.h~nix~case~hack~1". If a store path is dumped as a NAR, the suffixes are removed. Thus, importing and exporting via a case-insensitive Nix store is round-tripping. So when NixOps calls nix-copy-closure to copy the path to a Linux machine, you get the original file names back. Closes #119.
2014-07-10Fix broken Pid constructorEelco Dolstra
2014-07-10Refactoring: Move all fork handling into a higher-order functionEelco Dolstra
C++11 lambdas ftw.
2014-07-10Remove maybeVforkEelco Dolstra
2014-07-09Fix compilation error on some versions of GCCEelco Dolstra
src/libexpr/primops.cc:42:8: error: looser throw specifier for 'virtual nix::InvalidPathError::~InvalidPathError()' src/libexpr/nixexpr.hh:12:1: error: overriding 'virtual nix::EvalError::~EvalError() noexcept (true)' http://hydra.nixos.org/build/12385750
2014-06-12Don't use member initialisersEelco Dolstra
They're a little bit too recent (only supported since GCC 4.7). http://hydra.nixos.org/build/11851475
2014-06-12Fix bogus warnings about dumping large pathsEelco Dolstra
Also, yay for C++11 non-static initialisers.
2014-06-10Print a warning when loading a large path into memoryEelco Dolstra
I.e. if you have a derivation with src = ./huge-directory; you'll get a warning that this is not a good idea.
2014-05-21nix-store -l: Fetch build logs from the InternetEelco Dolstra
If a build log is not available locally, then ‘nix-store -l’ will now try to download it from the servers listed in the ‘log-servers’ option in nix.conf. For instance, if you have: log-servers = http://hydra.nixos.org/log then it will try to get logs from http://hydra.nixos.org/log/<base name of the store path>. So you can do things like: $ nix-store -l $(which xterm) and get a log even if xterm wasn't built locally.
2014-04-08If a .drv cannot be parsed, show its pathEelco Dolstra
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-04-03Tweak error messageEelco Dolstra
2014-03-28Don't interpret strings as format stringsEelco Dolstra
Ludo reported this error: unexpected Nix daemon error: boost::too_few_args: format-string refered to more arguments than were passed coming from this line: printMsg(lvlError, run.program + ": " + string(err, 0, p)); The problem here is that the string ends up implicitly converted to a Boost format() object, so % characters are treated specially. I always assumed (wrongly) that strings are converted to a format object that outputs the string as-is. Since this assumption appears in several places that may be hard to grep for, I've added some C++ type hackery to ensures that the right thing happens. So you don't have to worry about % in statements like printMsg(lvlError, "foo: " + s); or throw Error("foo: " + s);
2014-03-12Remove unnecessary null pointer checksEelco Dolstra
Fixes #225.
2014-02-27Set up a minimal /dev in chrootsEelco Dolstra
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
2014-02-26And another oneEelco Dolstra
2014-02-26Remove another unused functionEelco Dolstra
2014-02-26Remove unused functionEelco Dolstra
2014-02-01Remove AutomakefilesEelco Dolstra
2014-02-01Update Makefile variable namesEelco Dolstra