diff --git a/CHANGELOG.md b/CHANGELOG.md index 512c36357..5097215be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.10.1 + +**Internal:** + +- Correctly apply dynamic mutex initialization in unit-tests (fixes running unit-tests in downstream console SDKs) ([#1337](https://github.com/getsentry/sentry-native/pull/1337)) + ## 0.10.0 **Breaking changes**: diff --git a/README.md b/README.md index 629a6c23e..a0e88b734 100644 --- a/README.md +++ b/README.md @@ -146,9 +146,9 @@ LLVM + Clang are mandatory here : they are required to generate .pdb files, used For your application to generate the appropriate .pdb output, you need to activate CodeView file format generation on your application target. To do so, update your own CMakeLists.txt with something like `target_compile_options(${yourApplicationTarget} PRIVATE -gcodeview)`. -If you use a MSYS2 environement to compile with MinGW, make sure to : +If you use a MSYS2 environment to compile with MinGW, make sure to : -- Create an environement variable `MINGW_ROOT` (ex : `C:/msys64/mingw64`) +- Create an environment variable `MINGW_ROOT` (ex : `C:/msys64/mingw64`) - Run from `mingw64.exe` : `pacman -S --needed - < ./toolchains/msys2-mingw64-pkglist.txt` - Build as : diff --git a/include/sentry.h b/include/sentry.h index fe814a3af..9a7ada89e 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -78,7 +78,7 @@ extern "C" { # define SENTRY_SDK_NAME "sentry.native" # endif #endif -#define SENTRY_SDK_VERSION "0.10.0" +#define SENTRY_SDK_VERSION "0.10.1" #define SENTRY_SDK_USER_AGENT SENTRY_SDK_NAME "/" SENTRY_SDK_VERSION /* marks a function as part of the sentry API */ @@ -434,7 +434,7 @@ SENTRY_API int sentry_value_is_null(sentry_value_t value); * Serialize a sentry value to JSON. * * The string is freshly allocated and must be freed with - * `sentry_string_free`. + * `sentry_free`. */ SENTRY_API char *sentry_value_to_json(sentry_value_t value); @@ -561,7 +561,7 @@ SENTRY_EXPERIMENTAL_API void sentry_event_add_thread( * Serialize a sentry value to msgpack. * * The string is freshly allocated and must be freed with - * `sentry_string_free`. Since msgpack is not zero terminated + * `sentry_free`. Since msgpack is not zero terminated * the size is written to the `size_out` parameter. */ SENTRY_EXPERIMENTAL_API char *sentry_value_to_msgpack( @@ -713,7 +713,7 @@ SENTRY_EXPERIMENTAL_API sentry_value_t sentry_envelope_get_transaction( /** * Serializes the envelope. * - * The return value needs to be freed with sentry_string_free(). + * The return value needs to be freed with `sentry_free`. */ SENTRY_API char *sentry_envelope_serialize( const sentry_envelope_t *envelope, size_t *size_out); @@ -1551,7 +1551,7 @@ SENTRY_API int sentry_flush(uint64_t timeout); /** * Shuts down the sentry client and forces transports to flush out. * - * Returns 0 on success. + * Returns the number of envelopes that have been dumped. * * Note that this does not uninstall any crash handler installed by our * backends, which will still process crashes after `sentry_close()`, except @@ -1566,7 +1566,7 @@ SENTRY_API int sentry_close(void); /** * Shuts down the sentry client and forces transports to flush out. * - * Returns 0 on success. + * Returns the number of envelopes that have been dumped. */ SENTRY_DEPRECATED("Use `sentry_close` instead") SENTRY_API int sentry_shutdown(void); diff --git a/ndk/gradle.properties b/ndk/gradle.properties index bb0f9043a..5836ef108 100644 --- a/ndk/gradle.properties +++ b/ndk/gradle.properties @@ -7,7 +7,7 @@ org.gradle.parallel=true android.useAndroidX=true # Release information, used for maven publishing -versionName=0.10.0 +versionName=0.10.1 # disable renderscript, it's enabled by default android.defaults.buildfeatures.renderscript=false diff --git a/src/sentry_attachment.h b/src/sentry_attachment.h index cddac9c8b..553a33bed 100644 --- a/src/sentry_attachment.h +++ b/src/sentry_attachment.h @@ -17,15 +17,27 @@ typedef enum { /** * This is a linked list of all the attachments registered via * `sentry_options_add_attachment`. + * + * This struct represents a union of two attachment types: + * - File attachments: `path` is set, `buf`/`buf_len` are NULL/0 + * - Buffer attachments: `buf`/`buf_len` are set, `path` is NULL + * + * The `filename` field is used for both types to specify the attachment + * name in the envelope (defaults to basename of `path` for file attachments). */ struct sentry_attachment_s { - sentry_path_t *path; - sentry_path_t *filename; - char *buf; - size_t buf_len; + // File attachment data (mutually exclusive with buffer data) + sentry_path_t *path; // Full path to file on disk (NULL for buffers) + + // Buffer attachment data (mutually exclusive with file data) + char *buf; // In-memory buffer content (NULL for files) + size_t buf_len; // Buffer size in bytes (0 for files) + + // Common fields for both attachment types + sentry_path_t *filename; // Attachment name in envelope (can be NULL) sentry_attachment_type_t type; char *content_type; - sentry_attachment_t *next; + sentry_attachment_t *next; // Linked list pointer }; /** diff --git a/tests/assertions.py b/tests/assertions.py index aa8f8a26a..83f5e8d96 100644 --- a/tests/assertions.py +++ b/tests/assertions.py @@ -105,9 +105,9 @@ def assert_event_meta( } expected_sdk = { "name": "sentry.native", - "version": "0.10.0", + "version": "0.10.1", "packages": [ - {"name": "github:getsentry/sentry-native", "version": "0.10.0"}, + {"name": "github:getsentry/sentry-native", "version": "0.10.1"}, ], } if is_android: diff --git a/tests/test_integration_http.py b/tests/test_integration_http.py index 30ce91c34..51d846b4f 100644 --- a/tests/test_integration_http.py +++ b/tests/test_integration_http.py @@ -44,7 +44,7 @@ # fmt: off auth_header = ( - "Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.10.0" + "Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.10.1" ) # fmt: on diff --git a/tests/unit/test_concurrency.c b/tests/unit/test_concurrency.c index 18d3fe3ad..e8c7e5926 100644 --- a/tests/unit/test_concurrency.c +++ b/tests/unit/test_concurrency.c @@ -3,11 +3,17 @@ #include +#ifdef SENTRY__MUTEX_INIT_DYN +SENTRY__MUTEX_INIT_DYN(g_test_check_mutex) +#else static sentry_mutex_t g_test_check_mutex = SENTRY__MUTEX_INIT; +#endif static void send_envelope_test_concurrent(sentry_envelope_t *envelope, void *data) { + SENTRY__MUTEX_INIT_DYN_ONCE(g_test_check_mutex); + sentry__atomic_fetch_and_add((long *)data, 1); sentry_value_t event = sentry_envelope_get_event(envelope); @@ -27,6 +33,8 @@ send_envelope_test_concurrent(sentry_envelope_t *envelope, void *data) static void init_framework(long *called) { + SENTRY__MUTEX_INIT_DYN_ONCE(g_test_check_mutex); + sentry__mutex_lock(&g_test_check_mutex); SENTRY_TEST_OPTIONS_NEW(options); sentry__mutex_unlock(&g_test_check_mutex); diff --git a/tests/unit/test_sync.c b/tests/unit/test_sync.c index 33f365d90..795595554 100644 --- a/tests/unit/test_sync.c +++ b/tests/unit/test_sync.c @@ -59,11 +59,17 @@ sleep_task(void *UNUSED(data), void *UNUSED(state)) } static sentry_cond_t trailing_task_done; +#ifdef SENTRY__MUTEX_INIT_DYN +SENTRY__MUTEX_INIT_DYN(executed_lock) +#else static sentry_mutex_t executed_lock = SENTRY__MUTEX_INIT; +#endif static void trailing_task(void *data, void *UNUSED(state)) { + SENTRY__MUTEX_INIT_DYN_ONCE(executed_lock); + sentry__mutex_lock(&executed_lock); bool *executed = (bool *)data; *executed = true; @@ -93,6 +99,8 @@ collect(void *task, void *data) SENTRY_TEST(task_queue) { + SENTRY__MUTEX_INIT_DYN_ONCE(executed_lock); + sentry__cond_init(&trailing_task_done); sentry_bgworker_t *bgw = sentry__bgworker_new(NULL, NULL); TEST_ASSERT(!!bgw); diff --git a/tests/win_utils.py b/tests/win_utils.py index c6715a848..331dba54f 100644 --- a/tests/win_utils.py +++ b/tests/win_utils.py @@ -1,7 +1,7 @@ import pathlib import win32api -sentry_version = "0.10.0" +sentry_version = "0.10.1" def check_binary_version(binary_path: pathlib.Path):