Commit graph

4100 commits

Author SHA1 Message Date
Eelco Dolstra
1c2550a2ae boost::shared_ptr -> std::shared_ptr 2014-03-30 00:49:23 +01:00
Eelco Dolstra
9becaa041f Drop pointless #include 2014-03-29 22:20:33 +01:00
Eelco Dolstra
acb8facbbc Fix potential segfault in waitForInput()
Since the addition of build-max-log-size, a call to
handleChildOutput() can result in cancellation of a goal.  This
invalidated the "j" iterator in the waitForInput() loop, even though
it was still used afterwards.  Likewise for the maxSilentTime
handling.

Probably fixes #231.  At least it gets rid of the valgrind warnings.
2014-03-29 22:14:11 +01:00
Eelco Dolstra
90dc50b07c restoreSIGPIPE(): Fill in sa_mask
Issue #231.
2014-03-29 20:20:14 +01:00
Eelco Dolstra
49009573bc Don't interpret strings as format strings
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-28 16:59:26 +01:00
Ludovic Courtès
24cb65efc3 Make /dev/kvm optional
The daemon now creates /dev deterministically (thanks!).  However, it
expects /dev/kvm to be present.

The patch below restricts that requirement (1) to Linux-based systems,
and (2) to systems where /dev/kvm already exists.

I’m not sure about the way to handle (2).  We could special-case
/dev/kvm and create it (instead of bind-mounting it) in the chroot, so
it’s always available; however, it wouldn’t help much since most likely,
if /dev/kvm missing, then KVM support is missing.
2014-03-21 17:27:19 +01:00
Eelco Dolstra
3fc056927c Fix tabs 2014-03-18 23:23:55 +01:00
Ludovic Courtès
51800e06de Allow recovery from isValidPath RPCs with an invalid path
Currently, clients cannot recover from an isValidPath RPC with an
invalid path parameter because the daemon closes the connection when
that happens.

More precisely:

  1. in performOp, wopIsValidPath case, ‘readStorePath’ raises an
     ‘Error’ exception;

  2. that exception is caught by the handler in ‘processConnection’;

  3. the handler determines errorAllowed == false, and thus exits after
     sending the message.

This last part is fixed by calling ‘startWork’ early on, as in the patch
below.

The same reasoning could be applied to all the RPCs that take one or
more store paths as inputs, but isValidPath is, by definition, likely to
be passed invalid paths in the first place, so it’s important for this
one to allow recovery.
2014-03-18 23:22:49 +01:00
Eelco Dolstra
f93e97517e Fix -j and other flags when using the daemon 2014-03-17 17:35:11 +01:00
Eelco Dolstra
77e2cc6c8e nix-build: Fix --cores flag 2014-03-17 17:33:13 +01:00
Eelco Dolstra
fb8d8f5428 Remove unnecessary null pointer checks
Fixes #225.
2014-03-12 14:42:25 +01:00
Eelco Dolstra
006f24c7fa Document nix-env -q --json 2014-03-12 14:25:48 +01:00
Eelco Dolstra
d435e46daa Generate release notes again 2014-03-12 14:24:29 +01:00
Eelco Dolstra
e9934bb5ad Update release notes for 1.7 2014-03-12 13:58:06 +01:00
Eelco Dolstra
25386e5edc Fix passing meta attribute to buildenv.nix
Since the meta attributes were not sorted, attribute lookup could
fail, leading to package priorities and active flags not working
correctly.

Broken since 0f24400d90.
2014-03-11 17:34:02 +01:00
Eelco Dolstra
92a848f674 Fix typos 2014-03-11 13:16:21 +01:00
Shea Levy
2f2a20ed18 Document null dynamic attrs 2014-03-11 13:15:06 +01:00
Shea Levy
049a379ec6 The expr of AttrNames/DynamicAttrDefs is always an ExprConcatStrings 2014-03-10 10:14:50 +01:00
Shea Levy
908e9ce259 If a dynamic attribute name evaluates to null, remove it from the set 2014-03-10 10:14:50 +01:00
Eelco Dolstra
2caab81660 Revert "Make ifs and asserts tail-recursive"
This reverts commit 273322c773.
2014-03-05 16:18:13 +01:00
Eelco Dolstra
f7e077ad27 Install missing Boost headers
http://hydra.nixos.org/build/9328376
2014-03-05 11:11:24 +01:00
Eelco Dolstra
d6a45f6bdb Don't set an absolute soname 2014-03-03 15:29:58 +01:00
Eelco Dolstra
a376762848 Add support for making relocatable packages using $ORIGIN 2014-03-03 15:19:04 +01:00
Eelco Dolstra
3a86888fd7 Typo 2014-02-28 14:01:31 +01:00
Eelco Dolstra
4eac3b2471 Add a variable GLOBAL_CXXFLAGS_PCH for use by precompiled headers
You don't want to use GLOBAL_CXXFLAGS for passing flags like
"-include-pch" (clang), because that means you cannot use
GLOBAL_CXXFLAGS when generating the PCH.
2014-02-28 12:13:20 +01:00
Eelco Dolstra
4e7e498ff9 Add variable GLOBAL_COMMON_DEPS
This is a list of dependencies on which all C/C++ object files depend.
Primarily useful for global precompiled headers.
2014-02-28 12:01:42 +01:00
Eelco Dolstra
1017bd68ea Set up a private /dev/pts in the chroot 2014-02-27 23:35:23 +01:00
Eelco Dolstra
3fd01b171a Set up a minimal /dev in chroots
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-27 23:17:53 +01:00
Eelco Dolstra
c9f6232304 Correctly detect infinite recursion in function application
If we're evaluating some application ‘v = f x’, we can't store ‘f’
temporarily in ‘v’, because if ‘f x’ refers to ‘v’, it will get ‘f’
rather than an infinite recursion error.

Unfortunately, this breaks the tail call optimisation introduced in
c897bac549.

Fixes #217.
2014-02-27 21:47:59 +01:00
Eelco Dolstra
29cde917fe Fix deadlock in SubstitutionGoal
We were relying on SubstitutionGoal's destructor releasing the lock,
but if a goal is a top-level goal, the destructor won't run in a
timely manner since its reference count won't drop to zero.  So
release it explicitly.

Fixes #178.
2014-02-27 13:34:13 +01:00
Eelco Dolstra
7c7707638a Doh 2014-02-26 22:41:29 +01:00
Eelco Dolstra
7880973827 Test trace and addErrorContext 2014-02-26 19:12:31 +01:00
Eelco Dolstra
5ad263c26b Test some more primops 2014-02-26 19:08:44 +01:00
Eelco Dolstra
3d0a9ec825 Test executables in NARs 2014-02-26 18:59:01 +01:00
Eelco Dolstra
91f25f0510 And another one 2014-02-26 18:55:18 +01:00
Eelco Dolstra
432328cc55 Remove another unused function 2014-02-26 18:49:36 +01:00
Eelco Dolstra
509993e598 Remove unused function 2014-02-26 18:48:32 +01:00
Eelco Dolstra
d58ceae022 Test nix-env --switch-generation 2014-02-26 18:45:26 +01:00
Eelco Dolstra
7bbc68fdff Test nix-env --set 2014-02-26 18:42:19 +01:00
Eelco Dolstra
a0806389e9 Test the -b and -s flags of nix-store -q 2014-02-26 18:40:08 +01:00
Eelco Dolstra
a9c4a98770 Test ~/.nix-defexpr 2014-02-26 18:33:13 +01:00
Eelco Dolstra
045d3b2ed7 Test nix-store --switch-profile and more daemon actions 2014-02-26 18:28:55 +01:00
Eelco Dolstra
fac6f8aac0 Test nix-store -q --roots 2014-02-26 18:00:46 +01:00
Eelco Dolstra
84143c4bd8 Test nix-store -l 2014-02-26 17:58:53 +01:00
Eelco Dolstra
19437785eb Test nix-store --optimise 2014-02-26 17:53:51 +01:00
Eelco Dolstra
fdff3a7eae Add a test for nix-store --dump-db / --load-db 2014-02-26 17:47:54 +01:00
Eelco Dolstra
506d86394d Installer: Handle Darwin
"cp -r" doesn't copy symlinks properly on Darwin, but "cp -R" does.

Fixes #215.
2014-02-26 17:23:55 +01:00
Eelco Dolstra
6b9cd59a41 nix-store -r: Respect --add-root for non-derivations
Fixes #68.
Fixes #117.
2014-02-26 16:32:46 +01:00
Eelco Dolstra
7f74513b4e Also provide an option for setting the curl connection timeout 2014-02-26 16:07:43 +01:00
Eelco Dolstra
00d761016a Respect $NIX_CONNECT_TIMEOUT properly
We were 1) using CURLOPT_TIMEOUT instead of CURLOPT_CONNECTTIMEOUT; 2)
not passing it to the curl child process.

Issue #93.
2014-02-26 15:58:37 +01:00