Conversation
… via a new cinterop and improve marker handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #588
Description
This PR fixes an issue where logs on macOS (using
DarwinKLogger) would show<compose failure>when viewed in historical logs (vialog showor Console.app), despite appearing correctly in live logs (log stream).The issue was caused by passing a dynamically allocated format string to
os_log. Apple'sos_logsystem requires the format string to be a C string literal located in the__TEXT,__oslogstringsection of the binary for security and privacy (redaction) reasons. Wrappers or dynamic strings do not satisfy this requirement by default, causing the logging system to fail composition during archival.Solution
Implemented a C-interop solution to provide a valid static format string to
os_log:Added C-Interop Definition (
oslog.def): Created a C header/def file that defines a static inline functionkotlin_logging_os_log.This function uses
"%{public}s"as a constant C string literal, whichclangplaces in the correct section.Updated Build Configuration (
build.gradle.kts): Configured all Darwin targets to include this C-interop definition.Updated
DarwinKLogger: ModifiedDarwinKLogger.ktto callkotlin_logging_os_loginstead of_os_log_internal.Verification
Issue588Testto reproduce the issue.log show:log show --predicate 'processImagePath CONTAINS "test.kexe"' --info --style syslog --last 5m<compose failure>.Verification Log
Before Fix (Reproduction)
$ ./gradlew cleanMacosArm64Test macosArm64Test --tests Issue588Test -I fix_repo.gradle
...
$ log show --predicate 'processImagePath CONTAINS "test.kexe"' --info --style syslog --last 5m
Filtering the log data using "processImagePath CONTAINS "test.kexe""
Timestamp (process)[PID]
2026-01-09 08:29:14.011468+0200 localhost test.kexe[87338]: <compose failure [UUID]>
2026-01-09 08:29:14.011517+0200 localhost test.kexe[87338]: <compose failure [UUID]>
2026-01-09 08:29:14.011523+0200 localhost test.kexe[87338]: <compose failure [UUID]>
2026-01-09 08:29:14.012117+0200 localhost test.kexe[87338]: <compose failure [UUID]>
2026-01-09 08:29:14.012331+0200 localhost test.kexe[87338]: [issue588:repro] <compose failure [UUID]>
2026-01-09 08:29:14.012337+0200 localhost test.kexe[87338]: [issue588:repro] <compose failure [UUID]>
After Fix (Verification)
$ ./gradlew cleanMacosArm64Test macosArm64Test --tests Issue588Test -I fix_repo.gradle
...
$ log show --predicate 'processImagePath CONTAINS "test.kexe"' --info --style syslog --last 5m
Filtering the log data using "processImagePath CONTAINS "test.kexe""
Timestamp (process)[PID]
2026-01-09 08:36:46.297674+0200 localhost test.kexe[88330]: [issue588:repro] Test message execution F45C6A5D-EA44-49F4-BA75-7DD9BFD3AF12
2026-01-09 08:36:46.297683+0200 localhost test.kexe[88330]: [issue588:repro] Test error execution F45C6A5D-EA44-49F4-BA75-7DD9BFD3AF12