about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-24T17·10+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-24T17·15+0200
commit2d9bb56e554b17488c0f8984f34c026a66cdce67 (patch)
tree6978c0b90def65453ef13b32d2dd31dd7ebdf216 /scripts
parent5bc41d78ffcd2952eaddb20ef129f48e94d60cb0 (diff)
Fix segfault on Darwin
Ever since SQLite in Nixpkgs was updated to 3.8.0.2, Nix has randomly
segfaulted on Darwin:

  http://hydra.nixos.org/build/6175515
  http://hydra.nixos.org/build/6611038

It turns out that this is because the binary cache substituter somehow
ends up loading two versions of SQLite: the one in Nixpkgs and the
other from /usr/lib/libsqlite3.dylib.  It's not exactly clear why the
latter is loaded, but it appears to be because WWW::Curl indirectly loads
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation,
which in turn seems to load /usr/lib/libsqlite3.dylib.  This leads to
a segfault when Perl exits:

  #0  0x00000001010375f4 in sqlite3_finalize ()
  #1  0x000000010125806e in sqlite_st_destroy ()
  #2  0x000000010124bc30 in XS_DBD__SQLite__st_DESTROY ()
  #3  0x00000001001c8155 in XS_DBI_dispatch ()
  ...
  #14 0x0000000100023224 in perl_destruct ()
  #15 0x0000000100000d6a in main ()
  ...

The workaround is to explicitly load DBD::SQLite before WWW::Curl.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/download-from-binary-cache.pl.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/download-from-binary-cache.pl.in b/scripts/download-from-binary-cache.pl.in
index ab72e83e8f35..950bcd178527 100644
--- a/scripts/download-from-binary-cache.pl.in
+++ b/scripts/download-from-binary-cache.pl.in
@@ -1,6 +1,7 @@
 #! @perl@ -w @perlFlags@
 
 use DBI;
+use DBD::SQLite;
 use File::Basename;
 use IO::Select;
 use Nix::Config;