From df50916e46d80e640a36076f1c38c355b89999d4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 27 Aug 2010 12:10:56 +0000 Subject: [PATCH 1/4] * Oops - "null" was displayed as "true". --- src/libexpr/eval.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 96bda43a32..e55f28822b 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -39,7 +39,7 @@ std::ostream & operator << (std::ostream & str, const Value & v) str << v.path; // !!! escaping? break; case tNull: - str << "true"; + str << "null"; break; case tAttrs: { str << "{ "; From 923736df38c1415150afbe62983daf3fee8726b1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 14 Sep 2010 12:47:19 +0000 Subject: [PATCH 2/4] * Doh. Remove debug message. --- src/nix-env/nix-env.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 92ce41067d..df32b9f603 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -270,7 +270,6 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems, d = j->first.system == k->second.first.system ? 0 : j->first.system == thisSystem ? 1 : k->second.first.system == thisSystem ? -1 : 0; - printMsg(lvlError, format("%1% %2% %3% %4%") % j->first.system % k->second.first.system % thisSystem % d); if (d == 0) d = comparePriorities(state, j->first, k->second.first); if (d == 0) From 4aa92450832e87018513a2453e39858fab00833a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Oct 2010 10:51:16 +0000 Subject: [PATCH 3/4] * Hack needed for GCC 4.3.2 on OpenSolaris. --- src/libexpr/eval.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 0cdf0b2830..8eec94fcbc 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -5,12 +5,12 @@ #include "nixexpr.hh" #include "symbol-table.hh" +#include "hash.hh" namespace nix { -class Hash; class EvalState; struct Env; struct Value; From 450837bcc887a47260817611d01c22e35aba92b6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Oct 2010 11:23:07 +0000 Subject: [PATCH 4/4] * In printMsg(), ignore failing writes to stderr if we're in an exception handler, otherwise throw an exception. We need to ignore write errors in exception handlers to ensure that cleanup code runs to completion if the other side of stderr has been closed unexpectedly. --- src/libutil/util.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index c79ce1041c..32c8fce9a1 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -482,7 +482,16 @@ void printMsg_(Verbosity level, const format & f) else if (logType == ltEscapes && level != lvlInfo) prefix = "\033[" + escVerbosity(level) + "s"; string s = (format("%1%%2%\n") % prefix % f.str()).str(); - writeToStderr((const unsigned char *) s.c_str(), s.size()); + try { + writeToStderr((const unsigned char *) s.c_str(), s.size()); + } catch (SysError & e) { + /* Ignore failing writes to stderr if we're in an exception + handler, otherwise throw an exception. We need to ignore + write errors in exception handlers to ensure that cleanup + code runs to completion if the other side of stderr has + been closed unexpectedly. */ + if (!std::uncaught_exception()) throw; + } }