diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-17 23:52:11 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-19 06:09:42 -0600 |
commit | d9a83886f9aed4d61d9d18894637f883491b384b (patch) | |
tree | d98087be032d6af63798d19270efa9bc9a46fa9f /src | |
parent | 4050245faab80dad6cedaa13e481278456a139c0 (diff) |
libutil: remove exception handling workingness check
within lix itself this problem is caught by the test suite. outside of
lix itself three cases can be had: either the problem is fully inside
lix libs, fully inside user code, or it exists at the boundary. the
first is caught by the test suite, the second isn't caught at all, and
the third is something lix should not be responsible for.
Change-Id: I95aa35d8cb6f0ef5816a2941c467bc0c15916063
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/globals.cc | 2 | ||||
-rw-r--r-- | src/libutil/error.cc | 5 | ||||
-rw-r--r-- | src/libutil/error.hh | 4 | ||||
-rw-r--r-- | src/libutil/util.cc | 20 | ||||
-rw-r--r-- | src/libutil/util.hh | 2 |
5 files changed, 0 insertions, 33 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 14437e2f0..b7397da1a 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -402,8 +402,6 @@ void assertLibStoreInitialized() { void initLibStore() { - initLibUtil(); - if (sodium_init() == -1) throw Error("could not initialise libsodium"); diff --git a/src/libutil/error.cc b/src/libutil/error.cc index d30da58c0..b534ff87e 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -15,11 +15,6 @@ void BaseError::addTrace(std::shared_ptr<Pos> && e, HintFmt hint) err.traces.push_front(Trace { .pos = std::move(e), .hint = hint }); } -void throwExceptionSelfCheck(){ - // This is meant to be caught in initLibUtil() - throw SysError("C++ exception handling is broken. This would appear to be a problem with the way Nix was compiled and/or linked and/or loaded."); -} - // c++ std::exception descendants must have a 'const char* what()' function. // This stringifies the error and caches it for use by what(), or similarly by msg(). const std::string & BaseError::calcWhat() const diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 9cb3a624d..924366580 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -200,8 +200,4 @@ public: } }; -/** Throw an exception for the purpose of checking that exception handling works; see 'initLibUtil()'. - */ -void throwExceptionSelfCheck(); - } diff --git a/src/libutil/util.cc b/src/libutil/util.cc index a7a5ad039..645b1ef01 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -52,26 +52,6 @@ extern char * * environ __attribute__((weak)); namespace nix { -void initLibUtil() { - // Check that exception handling works. Exception handling has been observed - // not to work on darwin when the linker flags aren't quite right. - // In this case we don't want to expose the user to some unrelated uncaught - // exception, but rather tell them exactly that exception handling is - // broken. - // When exception handling fails, the message tends to be printed by the - // C++ runtime, followed by an abort. - // For example on macOS we might see an error such as - // libc++abi: terminating with uncaught exception of type nix::SysError: error: C++ exception handling is broken. This would appear to be a problem with the way Nix was compiled and/or linked and/or loaded. - bool caught = false; - try { - throwExceptionSelfCheck(); - } catch (const nix::Error & _e) { - caught = true; - } - // This is not actually the main point of this check, but let's make sure anyway: - assert(caught); -} - std::optional<std::string> getEnv(const std::string & key) { char * value = getenv(key.c_str()); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index d47d7e0be..860ddae06 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -33,8 +33,6 @@ namespace nix { struct Sink; struct Source; -void initLibUtil(); - /** * The system for which Nix is compiled. */ |