tvl-depot/src/libutil
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
..
affinity.cc Don't apply the CPU affinity hack to nix-shell (and other Perl programs) 2013-09-06 16:36:56 +02:00
affinity.hh Run the daemon worker on the same CPU as the client 2013-08-07 14:02:04 +02:00
archive.cc Set up a minimal /dev in chroots 2014-02-27 23:17:53 +01:00
archive.hh Use "#pragma once" to prevent repeated header file inclusion 2012-07-18 14:59:03 -04:00
hash.cc If hashes do not match, print them in base-32 for SHA-1/SHA-256 2012-10-23 18:05:50 +02:00
hash.hh If hashes do not match, print them in base-32 for SHA-1/SHA-256 2012-10-23 18:05:50 +02:00
local.mk Update Makefile variable names 2014-02-01 13:54:38 +01:00
md5.c * Optional switch "--with-openssl=<PATH>" to use OpenSSL's 2006-02-13 19:52:43 +00:00
md5.h * Some Cygwin fixes. 2006-05-24 13:23:20 +00:00
md32_common.h * Add SHA-256. 2005-01-14 12:03:04 +00:00
serialise.cc Remove unnecessary null pointer checks 2014-03-12 14:42:25 +01:00
serialise.hh Fix typos, especially those that end up in the Nix manual 2013-08-26 11:15:22 +02:00
sha1.c * Optional switch "--with-openssl=<PATH>" to use OpenSSL's 2006-02-13 19:52:43 +00:00
sha1.h * Optional switch "--with-openssl=<PATH>" to use OpenSSL's 2006-02-13 19:52:43 +00:00
sha256.c * Add SHA-256. 2005-01-14 12:03:04 +00:00
sha256.h * FreeBSD 4.x doesn't have stdint.h, use inttypes.h instead (which is 2005-05-04 16:32:54 +00:00
types.hh Don't interpret strings as format strings 2014-03-28 16:59:26 +01:00
util.cc Don't interpret strings as format strings 2014-03-28 16:59:26 +01:00
util.hh Don't interpret strings as format strings 2014-03-28 16:59:26 +01:00
xml-writer.cc And another one 2014-02-26 18:55:18 +01:00
xml-writer.hh And another one 2014-02-26 18:55:18 +01:00