Repository navigation
Version 0.2 is a stabilization of the whole framework: single CMake project, C++23, rewritten libraries (anch-network, anch-date, anch-rest), many fixes found by analyses, sanitizers and fuzzing, and a continuous integration. Version 0.1 was never tagged: this section compares with the code before 2026-10-27.
Breaking changes
Build and packaging:
- C++23 and GCC >= 13 (or Clang) are required. The build is a single CMake project (CMake >= 3.25) with presets: consumers use
find_package(Anch)andanch::<name>targets (anch::conf,anch::log, ...). - Shared libraries are built with hidden symbols visibility: only classes, functions and variables marked with the
ANCH_<NAME>_EXPORTmacros (generatedanch-<name>-export.hppheaders) are exported. Helpers defined in source files have internal linkage and are no longer exported in the global namespace. - Shared libraries SONAME is
libanch-<name>.so.0.2.
Libraries:
- anch-utils:
Singleton<T>prohibits copy and move, has protected constructor and destructor and checks thatTinherits from it.ThreadPoolis rewritten with persistent workers:add()returnsfalsewhen the task is rejected, the destructor drops queued tasks.converttakes astd::string_viewand refuses negative values for unsigned types and out of range values.Optionalinherits publicly fromstd::optional. - anch-events:
EventBus::fireEventno longer blocks (it behaves as formerscheduleDeferred) and the bus uses a permanent thread;Observerhas a virtual destructor. - anch-network: rewritten.
TcpStreamis astd::iostream,TcpServeraccepts connections asTcpStream,UdpSocketsends and receives datagrams, IPv4 and IPv6 are supported,IOExceptionderives fromstd::system_error. Message basedTcpSocket,SocketEventevents,TcpStreamServer/TcpStreamClientand Windows definitions are removed. - anch-date: rewritten on
std::chrono. Constructors and conversions are explicit,DateFormatteris not copyable and itsparse(str)returns theDateby value; the 11 per field formatter classes are replaced by internal classes. Parsing is strict. - anch-uuid: deprecated methods are removed;
UUIDis a 16 bytes value type. - anch-cli:
bindNumrefuses empty and out of range values,bindIFS/bindOFSrefuse files which can not be opened, a multiple positional argument has to be the last one. Formatting is disabled when the output is not a terminal, whenNO_COLORis set or whenANCH_CLI_NO_FMT=1. - anch-ini: spaces before
=are no longer part of the key;getValue<bool>accepts onlytrueandfalse(case is ignored) and raisesParserError(BAD_CAST) otherwise; commented lines containing=are ignored and empty values are read. - anch-conf: profiles are given by
ANCH_PROFILESand thedefault-profileskey (default-profileis still accepted); loading order is main file, includes, then each profile of each file. anch-conf no longer depends on anch-events. - anch-log:
FormatterType::ANCH_DATEis renamedPRECISE_DATE(it clashed with theANCH_DATEdefinition of anch-json);LoggerFactorydiagnostics are written on standard error. - anch-json: data after the root value is refused (
INVALID_FORMAT), a trailing comma in objects is refused,deserialize_max_field_char(never applied) is removed andmax_payloadraises the newPAYLOAD_TOO_LARGEerror code instead ofPOTENTIAL_OVERFLOW.anch::date::Dateandstd::chrono::year_month_dayare mapped to RFC 3339 strings whenANCH_DATEis defined. - anch-sql:
Connection::release()(called when a connection goes back to its pool) rolls back the current transaction: a transaction is committed only bycommit(). Prepared statements refuse unbound parameters and invalid indexes; fatal errors invalidate the connection. - anch-crypto:
Hashno longer keeps a_digestpointer:digest(...)methods return the virtualdigest(). - anch-ut: assertions in threads have to go through
ThreadErrors; tests run in registration order; runner options which are not implemented are refused. - anch-rest: rewritten (HTTP model, server API, client, libcurl transport, nginx module); it is still not built by default (
ANCH_BUILD_REST). The nginx module C ABI is at version 2: request and response bodies are streamed.
Added
- Build: CMake presets
release,debug,no-db,asan,tsan,clang,coverageandfuzz; installation with a CMake package and relative RPATH (ANCH_INSTALL_RPATH);ANCH_LOG_MIN_LEVELoption. - Continuous integration: GCC and Clang release builds, GCC 13 on Ubuntu 24.04, AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, installation test with shared and static libraries, coverage, libFuzzer targets (JSON, multipart, forms, media types, UUID, dates, Base64, INI), nginx module integration test and exported symbols check (
cmake/check-exports.sh). - anch-utils:
ResourcePoolserves waiting borrowers in arrival order. - anch-events:
EventHandler::unsubscribe. - anch-date: RFC 3339 date-time and full-date formatting and parsing (
anch::date::rfc3339). - anch-device: network interfaces listed with
getifaddrs(every interface, IPv6),NetworkInterface::isUp()andgetIpv6Addresses(); CPU detection compiles on non x86 architectures. - anch-log: stream API with compile-time levels (
LOG << anch::log::lvl::debug << ...);max-sizewith units andmax-rotate-files. - anch-conf: configuration cascade (includes and profiles) and event driven placeholders resolution (
${resolver=argument|default}) with cycle detection. - anch-json: required fields and value constraints (lengths, bounds, patterns, formats, ...),
validate()/isValid(), JSON Pointer path inMappingError. - anch-sql: SQL lexical scanner for placeholders, bounded prepared statements cache (LRU).
- anch-ut: assertion format checked at compile time (
assertThat), failure location,ThreadErrors. - anch-rest: content negotiation, forms, multipart/form-data (streamed parts), CORS, constraints checks by side, Protocol Buffers, gRPC-Web / Connect and Apache Thrift codecs and RPC.
- anch-oas: OpenAPI 3.0 models, constraints and anch-rest endpoints (server and client) generator (
anch-oas-gen).
Deprecated
- anch-ut:
anch::ut::assert(conflicts with the<cassert>macro), replaced byanch::ut::assertThat; removed in 0.3.
Fixed
Most fixes are described in the ANALYSE.md files of each library. Main ones:
- anch-utils:
ThreadPoolthreads which could outlive the pool,ResourcePoolconcurrency issues,Fluentcopies,Fluxreadiness. - anch-events: deadlocks and crashes when a handler used its bus or observable.
- anch-network: use-after-free and buffer overflow of the former sockets.
- anch-cutils: data corrupted in read / write mode, partial writes and write errors.
- anch-log: default pattern which did not write the message,
MDC,LowPriorityWriter, file rotation, writers per logger, concurrentgetLogger. - anch-date: daylight saving time added twice,
timespecmilliseconds,%yand%h, years outside 1678-2261. - anch-json:
0refused, numeric overflows, unescaped / undecoded strings, unbounded recursion, ignoredmax_payload, ignored objects with several fields; lost wake-up inFluxserialization. - anch-uuid: parsing validation, RFC 9562 compliant v3 / v5, monotonic v7.
- anch-sql: prepared statements placeholders, MySQL fatal errors never detected, DATE / TIME / TIMESTAMP columns read as the current date, transactions left open in pools.
- anch-crypto: out of bounds read in AES-192, uninitialized read and digest overflow in SHA-2, null SHA-1 digest, Base64 decoding of binary data and unpadded input.
- anch-conf: infinite loop with two profiles or includes.
- anch-ini: commented key / value lines read as values.
- anch-cli: out of range values, repeated options, ANSI codes in exception messages.
Full changelog: CHANGELOG.md