diff --git a/docker/ubuntu.Dockerfile b/docker/ubuntu.Dockerfile index 9c94ea923..5e4e5d5f3 100644 --- a/docker/ubuntu.Dockerfile +++ b/docker/ubuntu.Dockerfile @@ -1,7 +1,11 @@ -FROM ubuntu:latest +FROM ubuntu:xenial RUN apt update && \ - apt install -y build-essential cmake git libcap-dev curl ninja-build + apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget && \ + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - && \ + apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' && \ + apt-get update && \ + apt install -y build-essential cmake git libcap-dev curl ninja-build libuv1-dev WORKDIR /src/ diff --git a/llarp/service/identity.cpp b/llarp/service/identity.cpp index 73301d491..d4e373c07 100644 --- a/llarp/service/identity.cpp +++ b/llarp/service/identity.cpp @@ -86,11 +86,6 @@ namespace llarp // check for file if(!fs::exists(fname, ec)) { - if(ec) - { - LogError(ec); - return false; - } // regen and encode RegenerateKeys(); if(!BEncode(&buf)) diff --git a/llarp/util/fs.cpp b/llarp/util/fs.cpp index deb047601..fbbed480d 100644 --- a/llarp/util/fs.cpp +++ b/llarp/util/fs.cpp @@ -95,7 +95,7 @@ namespace llarp if(ec) llarp::LogError("failed to set permissions on ", pathname); } - else if(!ec) // file is not there + else // file is not there { errno = 0; int fd = ::open(str.c_str(), O_RDWR | O_CREAT, 0600); @@ -105,6 +105,7 @@ namespace llarp ::close(fd); } } + if(ec) llarp::LogError("failed to ensure ", str, ", ", ec.message()); return ec; diff --git a/llarp/util/metrics_core.cpp b/llarp/util/metrics_core.cpp index c758ecab6..932d5215a 100644 --- a/llarp/util/metrics_core.cpp +++ b/llarp/util/metrics_core.cpp @@ -6,7 +6,7 @@ namespace llarp { namespace metrics { - std::tuple< Id, bool > + std::pair< Id, bool > Registry::insert(string_view category, string_view name) { // avoid life time issues, putting strings in the stringmem set @@ -18,7 +18,7 @@ namespace llarp if(it != m_metrics.end()) { - return std::make_tuple(Id(it->second.get()), false); + return {Id(it->second.get()), false}; } auto cIt = m_categories.find(cStr); diff --git a/llarp/util/metrics_core.hpp b/llarp/util/metrics_core.hpp index b7fa4359c..fecfbee27 100644 --- a/llarp/util/metrics_core.hpp +++ b/llarp/util/metrics_core.hpp @@ -286,7 +286,7 @@ namespace llarp Registry & operator=(const Registry &) = delete; - std::tuple< Id, bool > + std::pair< Id, bool > insert(string_view category, string_view name) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); diff --git a/test/util/test_llarp_util_printer.cpp b/test/util/test_llarp_util_printer.cpp index c7cf12671..467bcdb75 100644 --- a/test/util/test_llarp_util_printer.cpp +++ b/test/util/test_llarp_util_printer.cpp @@ -91,20 +91,20 @@ TEST_P(SingleAttributeTest, value) // clang-format off static const SingleAttributeType singleAttributeType[] = { - {"our_value", char('a'), StrEq("[ our_value = 'a' ]")}, - {"our_value", bool(true), StrEq("[ our_value = true ]")}, - {"our_value", bool(false), StrEq("[ our_value = false ]")}, - {"our_value", short(123), StrEq("[ our_value = 123 ]")}, - {"our_value", int(INT_MAX - 1), StrEq("[ our_value = 2147483646 ]")}, - {"our_value", static_cast< unsigned int >(std::numeric_limits< int >::max()) + 1, StrEq("[ our_value = 2147483648 ]")}, - {"our_value", static_cast< const void * >(PTR_TYPE), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))}, - {"our_value", static_cast< const char * >(PTR_TYPE), StrEq("[ our_value = \"abacus\" ]")}, - {"our_value", std::string("abacus"), StrEq("[ our_value = \"abacus\" ]")}, - {"our_value", static_cast< const int * >(&INT_VAL), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))}, - {"our_value", std::pair< int, std::string >(100, "abacus"), StrEq("[ our_value = [ 100 \"abacus\" ] ]")}, - {"our_value", std::tuple< int, std::string, int >(100, "abacus", 123), StrEq("[ our_value = [ 100 \"abacus\" 123 ] ]")}, - {"our_value", std::map< std::string, char >{{"one", 'a'}, {"two", 'b'}, {"three", 'c'}}, StrEq("[ our_value = [ [ \"one\" \'a\' ] [ \"three\" \'c\' ] [ \"two\" 'b' ] ] ]")}, - {"our_value", PrintableType(), StrEq("[ our_value = PrintableType -2 -1 ]")}, + SingleAttributeType("our_value", char('a'), StrEq("[ our_value = 'a' ]")), + SingleAttributeType("our_value", bool(true), StrEq("[ our_value = true ]")), + SingleAttributeType("our_value", bool(false), StrEq("[ our_value = false ]")), + SingleAttributeType("our_value", short(123), StrEq("[ our_value = 123 ]")), + SingleAttributeType("our_value", int(INT_MAX - 1), StrEq("[ our_value = 2147483646 ]")), + SingleAttributeType("our_value", static_cast< unsigned int >(std::numeric_limits< int >::max()) + 1, StrEq("[ our_value = 2147483648 ]")), + SingleAttributeType("our_value", static_cast< const void * >(PTR_TYPE), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))), + SingleAttributeType("our_value", static_cast< const char * >(PTR_TYPE), StrEq("[ our_value = \"abacus\" ]")), + SingleAttributeType("our_value", std::string("abacus"), StrEq("[ our_value = \"abacus\" ]")), + SingleAttributeType("our_value", static_cast< const int * >(&INT_VAL), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))), + SingleAttributeType("our_value", std::pair< int, std::string >(100, "abacus"), StrEq("[ our_value = [ 100 \"abacus\" ] ]")), + SingleAttributeType("our_value", std::tuple< int, std::string, int >(100, "abacus", 123), StrEq("[ our_value = [ 100 \"abacus\" 123 ] ]")), + SingleAttributeType("our_value", std::map< std::string, char >{{"one", 'a'}, {"two", 'b'}, {"three", 'c'}}, StrEq("[ our_value = [ [ \"one\" \'a\' ] [ \"three\" \'c\' ] [ \"two\" 'b' ] ] ]")), + SingleAttributeType("our_value", PrintableType(), StrEq("[ our_value = PrintableType -2 -1 ]")), }; // clang-format on