1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00

33316 Commits

Author SHA1 Message Date
Luca Bacci
38647c97b1 Don't check for O_CLOEXEC
O_CLOEXEC was introduced in POSIX.2008; we can assume it's
supported on all systems these days.
2026-08-25 12:13:46 +02:00
Luca Bacci
016428f9bc Meson: Define O_CLOEXEC as O_NOINHERIT on Windows
O_NOINHERIT is the equivalent of O_CLOEXEC on Windows
2026-08-24 11:49:54 +02:00
Philip Withnall
fa41d356ee 2.89.4
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.89.4
2026-08-23 16:13:07 +01:00
Philip Withnall
8382533483 Merge branch 'wip/chergert/splice-buffer-size' into 'main'
gio/outputstream: increase splice buffer size

See merge request GNOME/glib!5316
2026-08-23 14:53:46 +00:00
Philip Withnall
d075453fe2 Merge branch 'update-translation-sv-from-main-2bdb6378-9ef4-11f1-8cb6-0a580a80003b' into 'main'
Update Swedish translation

See merge request GNOME/glib!5318
2026-08-23 14:22:28 +00:00
Philip Withnall
1586b7ae46 Merge branch 'update-translation-oc-from-main-e35cbbea-9ee6-11f1-9f97-0a580a8305ca' into 'main'
Update Occitan translation

See merge request GNOME/glib!5317
2026-08-23 14:22:14 +00:00
Anders Jonsson
5de12c1a1a Update Swedish translation 2026-08-23 13:11:52 +00:00
Quentin PAGÈS
0fa20d2031 Update Occitan translation 2026-08-23 11:36:55 +00:00
Jonathan Matthew
d4121e4445 Merge branch 'jmatthew-bsd' into 'main'
docs: Remove Jonathan Matthew as a co-maintainer

See merge request GNOME/glib!5313
2026-08-23 10:08:14 +00:00
Philip Withnall
c2237ff1cb Merge branch 'wip/otte/ready-or-not-here-i-come' into 'main'
gmain: When ready time has elapsed, a source is prepared

Closes mutter#4994

See merge request GNOME/glib!5314
2026-08-22 13:34:50 +00:00
Philip Withnall
ba34d6a1ae tests: Add a regression test for main context prepare readiness
This would have caught the regression fixed in the previous commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://gitlab.gnome.org/GNOME/mutter/-/work_items/4994
2026-08-22 14:04:02 +01:00
Christian Hergert
4d265ed042 gio: Pipeline and enlarge output stream splices
The default splice implementations used 8 KiB buffers. In the
asynchronous implementation, mixed native-async and worker-backed
streams therefore alternated between reading on the main context and
dispatching each small write through the worker pool.

Use 256 KiB buffers for both synchronous and asynchronous splices to
amortize syscall and dispatch overhead. Allocate the synchronous
buffer on the heap to avoid growing the stack.

Use two buffers for asynchronous splices so the next input read can
run while the previous output write drains. Keep at most one operation
outstanding on each stream to preserve their concurrency guarantees
and provide bounded backpressure.

Stop scheduling new operations after the first error, but wait for any
overlapping callback before completing the splice. This keeps task
lifetimes safe and preserves partial-write, cancellation, close, and
error-reporting semantics.

In a local 1 GiB libsoup download benchmark, this reduced asynchronous
splice time from 3.09 seconds to 0.44 seconds.

Add deterministic tests for synchronous bulk copies, asynchronous
buffer overlap, ordering, partial writes, concurrent read and write
failures, cancellation during overlap, and all close-flag
combinations.
2026-08-22 14:26:52 +02:00
Philip Withnall
ffb0f9ba3d Merge branch 'update-translation-kk-from-main-84a2f112-9dda-11f1-a8eb-0a580a80003b' into 'main'
Update Kazakh translation

See merge request GNOME/glib!5315
2026-08-22 12:09:47 +00:00
Baurzhan Muftakhidinov
b459ed99f4 Update Kazakh translation 2026-08-22 03:35:54 +00:00
Benjamin Otte
4091e4de90 gmain: When ready time has elapsed, a source is prepared
Restores an accidentally removed line of code in a previous refactoring.

Fixes: mutter#4994
Fixes: 0d957f234a
2026-08-21 14:46:40 +02:00
Philip Withnall
ba08f5b1fb docs: Remove Jonathan Matthew as a co-maintainer
As per https://gitlab.gnome.org/GNOME/glib/-/work_items/4029#note_2847136

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-08-21 12:51:25 +01:00
Philip Withnall
1c861a2384 Merge branch 'mcatanzaro/os-path-commonprefix' into 'main'
mkenums: remove use of deprecated os.path.commonprefix()

See merge request GNOME/glib!5312
2026-08-21 11:42:10 +00:00
Michael Catanzaro
e2ed2d54ba mkenums: remove use of deprecated os.path.commonprefix()
This path function is deprecated because it doesn't work properly if you
are using paths. glib-mkenums is using it "properly" in the sense that
it is not passing it any paths, but on the other hand, passing non-paths
to a path function is pretty silly. You can see why the function is
deprecated.

Embarassingly, my replacement implementation is AI-generated, although I
have simplified it to be less robust than the AI proposed. Why did I
intentionally make the function less robust? Because it's only used in
one place, and doesn't need to be able to handle any possible number of
arguments.
2026-08-20 19:27:54 -05:00
Philip Withnall
ce24699223 Merge branch 'tsan-races-fixes' into 'main'
Handle some thread sanitizer races

See merge request GNOME/glib!5309
2026-08-19 11:19:38 +00:00
Marco Trevisan (Treviño)
bd94fb2ab1 gmain: Initialize the timeout perturbation value with g_once
timer_perturb was a static int lazily initialized inside
g_timeout_set_expiration() without any synchronisation, so creating
timeout sources from multiple threads at once was racy.

Use g_once_init_enter()/g_once_init_leave() to init it exactly once,
storing the value plus one since g_once_init_leave() treats 0 as
"not initialized".

WARNING: ThreadSanitizer: data race (pid=6107)
  Write of size 4 at 0x7fb009fcdb74 by thread T40:
    #0 g_timeout_set_expiration ../glib/gmain.c:5447
    #1 timeout_source_new ../glib/gmain.c:5524
    #2 g_timeout_source_new_seconds ../glib/gmain.c:5594
    #3 source_create_unref_thread_func ../glib/tests/mainloop.c:2810

  Previous read of size 4 at 0x7fb009fcdb74 by thread T41:
    #0 g_timeout_set_expiration ../glib/gmain.c:5436
    #1 timeout_source_new ../glib/gmain.c:5524
    #2 g_timeout_source_new_seconds ../glib/gmain.c:5594
    #3 source_create_unref_thread_func ../glib/tests/mainloop.c:2810

  Location is global 'timer_perturb.7' of size 4

  SUMMARY: ThreadSanitizer: data race ../glib/gmain.c:5447 in
           g_timeout_set_expiration
2026-08-18 18:25:47 +02:00
Marco Trevisan (Treviño)
cee062aacc gmain: Lock the source context assignment when attaching a source
g_source_attach_unlocked() was setting source->context without holding
the source_destroy_lock, while source_dup_main_context() reads it under
that lock, so a source being attached (along with its child sources)
could race with another thread cancelling it and querying its context.

Hold the source_destroy_lock as a writer around the attach, in both
g_source_attach() and g_source_add_child_source(), following the
documented lock order (source_destroy_lock, then context lock).

  WARNING: ThreadSanitizer: data race (pid=18493)
    Read of size 8 at 0x722000009c20 by main thread:
      #0 source_dup_main_context ../glib/gmain.c:1399
      #1 g_source_update_ready_time_internal ../glib/gmain.c:2047
      #2 g_source_set_ready_time ../glib/gmain.c:2133
      #3 cancellable_source_cancelled ../gio/gcancellable.c:743
    Previous write of size 8 at 0x722000009c20 by thread T3:
      #0 g_source_attach_unlocked ../glib/gmain.c:1244
      #1 g_source_attach_unlocked ../glib/gmain.c:1268
      #2 g_source_attach ../glib/gmain.c:1324
      #3 g_task_attach_source ../gio/gtask.c:1807
    SUMMARY: ThreadSanitizer: data race ../glib/gmain.c:1399 in
             source_dup_main_context
2026-08-18 18:25:47 +02:00
Marco Trevisan (Treviño)
b4fbca7088 gio/task: Avoid racing on the completed and return status flags
The completed, had_error, result_set and ever_returned flags were packed
into the same bitfield storage unit, but they are accessed from different
threads when a task running in a thread is completed while the task
function is still running (as happens with return-on-cancel): the
completing thread writes completed and reads had_error, while the task
thread keeps writing result_set and ever_returned.

Since those accesses are not otherwise synchronized, the thread sanitizer
reports them as a data race on the shared byte. Split completed and
had_error into their own storage units, leaving result_set and
ever_returned together as they are both only written by the task thread.

  WARNING: ThreadSanitizer: data race (pid=11059)
    Read of size 1 at 0x723000002858 by thread T6:
      #0 g_task_return_int ../gio/gtask.c:1927
      #1 return_on_cancel_atomic_thread ../gio/tests/task.c:1935
      #2 g_task_thread_pool_thread ../gio/gtask.c:1585

    Previous write of size 1 at 0x723000002858 by main thread:
      #0 g_task_return_now ../gio/gtask.c:1368
      #1 complete_in_idle_cb ../gio/gtask.c:1377
      #2 g_idle_dispatch ../glib/gmain.c:6691

  SUMMARY: ThreadSanitizer: data race ../gio/gtask.c:1927 in g_task_return_int

  WARNING: ThreadSanitizer: data race (pid=1797072)
    Write of size 1 at 0x723000000f9c by thread T10:
      #0 g_task_return ../gio/gtask.c:1397
      #1 g_task_return_int ../gio/gtask.c:1933
      #2 return_on_cancel_atomic_thread ../gio/tests/task.c:1935

    Previous read of size 1 at 0x723000000f9c by main thread:
      #0 g_task_had_error ../gio/gtask.c:2215
      #1 return_on_cancel_atomic_callback ../gio/tests/task.c:1884
      #2 g_task_return_now ../gio/gtask.c:1365

  SUMMARY: ThreadSanitizer: data race ../gio/gtask.c:1397 in g_task_return
2026-08-18 18:25:47 +02:00
Marco Trevisan (Treviño)
5fccdeb826 gtestutils: Make new-line check state thread-local
g_test_print_handler_full() keeps a flag tracking whether the previous
g_test_print*() output ended mid-line, so the next chunk knows whether
to prepend the TAP line prefix. It was a single shared static, which
races when the handler is called concurrently from multiple threads:
ThreadSanitizer reports a data race between the read that decides the
prefix (at the start of a chunk) and the write that records the chunk's
trailing newline (at its end).

Give each thread its own copy of the flag via GPrivate. The flag is only
meaningful within a single stream (i.e. within one thread), so per-thread
state keeps the logic correct for the common case and removes the shared
memory that ThreadSanitizer flagged.
2026-08-18 18:25:47 +02:00
Marco Trevisan (Treviño)
c121809bf6 gio/subprocess: Free the pending wait list under lock in TSAN
The pending_waits list is filled by g_subprocess_wait_async() while
holding the pending_waits_lock, but g_subprocess_exited() was freeing
the list items without holding it, potentially racing with a concurrent
wait.

This makes the thread sanitizer unhappy, so free the list nodes while
holding the lock, but only after the tasks have been returned to their
callers, since that may run arbitrary code we don't want to run while
holding it.

  WARNING: ThreadSanitizer: data race (pid=1202215)
    Write of size 8 at 0x720400000c00 by thread T1:
      #0 free_sized ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:748
      #1 g_slist_delete_link ../../glib/glib/gslist.c:498

    Previous write of size 8 at 0x720400000c00 by main thread:
      #0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:670
      #1 g_malloc ../../glib/glib/gmem.c:100
      #2 emit_end_element ../../glib/glib/gmarkup.c:1077

    Thread T1 'gmain' (tid=1202287, running) created by main thread at:
      #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1078
      #1 g_system_thread_new ../../glib/glib/gthread-posix.c:762
      #2 emit_end_element ../../glib/glib/gmarkup.c:1077

  SUMMARY: ThreadSanitizer: data race ../../glib/glib/gslist.c:498 in
           g_slist_delete_link
2026-08-18 18:25:47 +02:00
Marco Trevisan (Treviño)
3c83709da5 glib-private: Add macro to detect if thread sanitizer is being used 2026-08-18 18:25:11 +02:00
Philip Withnall
4a0871e951 Merge branch 'meson-build-tests-deps-fixes' into 'main'
build: Some test dependencies fixes

See merge request GNOME/glib!5308
2026-08-18 15:10:57 +00:00
Philip Withnall
34287a5a07 Merge branch 'array-conversion-warning-fix' into 'main'
gbsearcharray: Fix a -Wsign-conversion warning in G_BSEARCH_UPPER_POWER2

See merge request GNOME/glib!5310
2026-08-18 15:05:23 +00:00
Marco Trevisan (Treviño)
7728776d7a gbsearcharray: Fix a -Wsign-conversion warning in G_BSEARCH_UPPER_POWER2
The shift `1 << g_bit_storage (...)` has type `int`, which is then
implicitly converted to `guint` when the macro result is assigned to a
`guint` variable, triggering `-Wsign-conversion`.

Use an unsigned literal so the result is unsigned and no conversion is
needed.
2026-08-17 20:49:05 +02:00
Marco Trevisan (Treviño)
bdf3bf6070 gio/tests/gsocketclient-slow: Do not hard code the pre-loaded library name
Get the values from meson instead of doing all this manually
2026-08-17 20:43:37 +02:00
Marco Trevisan (Treviño)
a9c17280bb girepo/tests: add platform GLib GIR deps
Build GLibUnix/GLibWin32 GIR data for GIR tests too.
Prevents missing GLibUnix typelibs on Gio/GLib requires.
2026-08-17 20:35:28 +02:00
Marco Trevisan (Treviño)
7a4543f7d0 build: Add quotes to installed test variables
The value may contain spaces, so we need to quote them or we may
consider values as arguments
2026-08-17 20:34:56 +02:00
Marco Trevisan (Treviño)
6fa19a0612 gio/tests/build: Make gio-tool.py test depend on gio-launch-desktop
The tool may want to launch a desktop file, and if the launcher tool is
not available yet we fail with:

 #  gio: Unable to launch application ‘/tmp/tmphl5tyb5u/folder/desktop.entry’:
 # Failed to execute child process
 # “/builds/GNOME/glib/_build/gio/gio-launch-desktop” (No such file or directory)
  ---
    message: |
      Traceback (most recent call last):
        File "/builds/GNOME/glib/_build/../gio/tests/gio-tool.py", line 141, in
        test_absolute_from_folder
          self.launchAndCheck(self.entry, cwd=self.folder)
          ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/builds/GNOME/glib/_build/../gio/tests/gio-tool.py", line 135, in
        launchAndCheck
          result = self.runTestProgram(["launch", str(entry)], cwd=str(cwd))
        File "/builds/GNOME/glib/tests/lib/testprogramrunner.py", line 157, in
        runTestProgram
          info.check_returncode()
          ~~~~~~~~~~~~~~~~~~~~~^^
        File "/usr/lib64/python3.13/subprocess.py", line 508, in check_returncode
          raise CalledProcessError(self.returncode, self.args, self.stdout,
                                   self.stderr)
      subprocess.CalledProcessError:
        Command '['/builds/GNOME/glib/_build/gio/gio', 'launch',
                  '/tmp/tmphl5tyb5u/folder/desktop.entry']'
      returned non-zero exit status 1.
2026-08-17 20:34:56 +02:00
Marco Trevisan (Treviño)
b3249efece glib/tests/gdatetime: Plug a leak 2026-08-17 19:54:01 +02:00
Philip Withnall
f1457694ac Merge branch 'lbacci-not-lb90' into 'main'
glib.doap: Fix Luca’s GNOME username

Closes Infrastructure/Infrastructure#2374

See merge request GNOME/glib!5307
2026-08-17 14:41:45 +00:00
Philip Withnall
738933e070 glib.doap: Fix Luca’s GNOME username
GNOME username ≠ GitLab username.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: https://gitlab.gnome.org/Infrastructure/Infrastructure/-/work_items/2374
2026-08-17 15:29:20 +01:00
Philip Withnall
96e5c99aa1 Merge branch 'gnotification-win32-notify-click' into 'main'
gnotification-win32: Handling notification icon click

See merge request GNOME/glib!5019
2026-08-17 14:12:33 +00:00
otaxhu
1638571484 gnotification-win32: Handling notification icon click
Activating default application when ENTER, SPACE and LEFTCLICK keystrokes are pressed.

gnotification-win32: Showing tooltip on notification icon

Tooltip based on string returned by g_get_application_name
2026-08-17 09:37:05 -04:00
Philip Withnall
c1d0d7d42c Merge branch 'gbitlock-custom-assembly-tsan' into 'main'
gbitlock: Add TSAN annotations for custom assembly

Closes #1936, #3359, and #3695

See merge request GNOME/glib!5303
2026-08-17 12:12:39 +00:00
Luca Bacci
083de9604e Revert "glib/tests/1bit-emufutex: Mark it as failing under ASAN"
This reverts commit f7b1ed1bf3.

I can't seem to reproduce the failure.

Related: #3359
2026-08-17 13:53:55 +02:00
Luca Bacci
f555b902c4 gbitlock: Use custom assembly also on CLang
support for asm goto was added in CLang 9.0.0.

Fixes #1936

References:

 1. "Clang 9.0.0 Release Notes"
    https://releases.llvm.org/9.0.0/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang

 2. "Bug 9295 - Support for asm goto"
    https://bugs.llvm.org/show_bug.cgi?id=9295
2026-08-17 13:50:50 +02:00
Luca Bacci
21937938ac gbitlock: Add TSAN acquire / release annotations for custom assembly
TSAN instruments common threading functions (pthreads, atomic builtins,
C11 atomics, etc.). However custom assembly can't be inspected by TSAN [1];
it's responsibility of the coder to add proper annotations [2].

Fixes #3359, #3695

References:

 1. "Handle assembly in sanitizer tools"
    https://github.com/google/sanitizers/issues/192

 2. "Inline assembly cmpxchg is not detected by TSAN"
    https://github.com/google/sanitizers/issues/1443#issuecomment-919850183
2026-08-17 13:42:53 +02:00
Philip Withnall
d4983470cf Merge branch 'gnotification-app-prop' into 'main'
gnotification-backend: Setting application as a GObject property

See merge request GNOME/glib!5022
2026-08-17 10:57:34 +00:00
otaxhu
17ae707805 gnotification-backend: Setting application as a GObject property
This allows us to use it in `constructed` method
2026-08-17 10:57:34 +00:00
Philip Withnall
76fb0b8750 Merge branch 'update-translation-bg-from-main-bbe8c016-997a-11f1-bc01-0a580a8204b9' into 'main'
Update Bulgarian translation

See merge request GNOME/glib!5305
2026-08-17 08:58:32 +00:00
Alexander Alexandrov Shopov
3a652fbf88 Update Bulgarian translation 2026-08-16 13:59:48 +00:00
Emmanuele Bassi
ed3abf0b52 Merge branch '3836-filename-completer-ordering' into 'main'
gfilenamecompleter: Document returned completion order is unspecified

Closes #3836

See merge request GNOME/glib!5278
2026-08-13 15:20:01 +01:00
Philip Withnall
9f75ba878a Merge branch 'wip/otte/improved-test-attempt' into 'main'
testsuite: Improve monotonic time test

Closes #4025

See merge request GNOME/glib!5300
2026-08-13 11:14:59 +00:00
Philip Withnall
fc5cbce698 Merge branch 'update-translation-be-from-main-1a151b02-9684-11f1-9c82-0a580a83040a' into 'main'
Update Belarusian translation

See merge request GNOME/glib!5299
2026-08-13 11:03:48 +00:00
Philip Withnall
28b4908086 Merge branch 'wip/lantw/tests-Check-FreeBSD-version-at-runtime' into 'main'
tests: Check FreeBSD version at runtime

Closes #4023

See merge request GNOME/glib!5298
2026-08-13 10:59:49 +00:00
Philip Withnall
032404c219 Merge branch 'wip/kabus/fix-selinux-con-symlink' into 'main'
localfileinfo: Fix swapped selinux context symlink logic

See merge request GNOME/glib!5301
2026-08-13 10:58:38 +00:00