Commit Graph

30777 Commits

Author SHA1 Message Date
Philip Withnall
ca20e4ac71
2.82.4
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 22:21:22 +00:00
Emmanuele Bassi
899caabcda Merge branch 'wip/pwithnall/release-infra-glib-2-82' into 'glib-2-82'
Backport !4432 and !4433 “ci: Add release component to automate tarball publishing” to glib-2-82

See merge request GNOME/glib!4434
2024-12-11 18:34:52 +00:00
Philip Withnall
49a1b51141
ci: Fix output paths for docs tarballs in dist-job
Otherwise they’re not picked up as artifacts, and hence are basically
lost.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:50:21 +00:00
Philip Withnall
72fe3b5970
ci: Run dist-job on a schedule as well as on tags
This will allow us to test that it actually still works, which is
important for being able to make releases, because once we push a tag,
there’s no going back. The release can’t happen if `dist-job` then fails
on that tag.

Sigh.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:50:14 +00:00
Philip Withnall
1c318263d4
ci: Clear dependencies for dist-job
Otherwise it never executes, because it’s waiting patiently for zero
dependencies to complete. 🤦

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:50:07 +00:00
Philip Withnall
f2488ef526
ci: Enable -Dintrospection for dist builds
This means that the documentation can actually be generated, which was
broken before. Building the documentation requires `enable_gir`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:50:01 +00:00
Philip Withnall
53c197bd61
ci: Slightly improve quoting of variables
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-11 17:41:47 +00:00
Jordan Petridis
89b79e3af7
ci: Add release component to automate tarball publishing
Publishing the dist tarball to download.gnome.org is now automated.

See [1]

[1] https://gitlab.gnome.org/Teams/Websites/handbook.gnome.org/-/merge_requests/83/
2024-12-11 17:41:41 +00:00
Philip Withnall
d02c95c91a Merge branch 'backport-4427-revert-dbus-method-invocation-refcounting-glib-2-82' into 'glib-2-82'
Backport !4427 “Revert "gdbus: Fix leak of method invocation when registering an object with closures"” to glib-2-82

See merge request GNOME/glib!4430
2024-12-11 13:23:57 +00:00
Philip Withnall
557d2e498d
gdbusconnection: Document existing refcount semantics of closures
As per the previous few commits, explicitly document the established
reference counting semantics of the method call closure for
`g_dbus_connection_register_object_with_closures()`.

This isn’t ideal, but
`g_dbus_connection_register_object_with_closures()` has had these
semantics for 10 years now, and it’s a bit late to change them to
something neater.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3559
2024-12-11 12:47:23 +00:00
Philip Withnall
1b66bf4122
gdbusconnection: Add a comment explaining why an invocation is ‘leaked’
It’s not leaked, it’s transferred forwards to the eventual
`g_dbus_method_invocation_return_*()` call.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3559
2024-12-11 12:47:16 +00:00
Philip Withnall
60e9deb2b0
Revert "gdbus: Fix leak of method invocation when registering an object with closures"
This reverts commit 092fedd5f0.

This was not the right change to make, and I shouldn’t have accepted the
MR. The situation is laid out in this comment:
https://gitlab.gnome.org/GNOME/glib/-/issues/2600#note_1385050

tl;dr: The reference on the `GDBusMethodInvocation` which is transferred
in to the `GDBusInterfaceMethodCallFunc` is balanced by a reference
transferred to `g_dbus_method_invocation_return_*()`. This is how the
refcounting has always worked for these functions, and even if we’d
probably arrange things differently if the code was written now, we
can’t change those semantics without breaking API.

In particular, bindings have various bits of custom code to account for
these reference tranfers (since they can’t be represented using
gobject-introspection annotations), so changing the semantics will break
bindings.

Fixes: #3559
2024-12-11 12:47:10 +00:00
Philip Withnall
4159df97f5
2.82.3
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-12-09 14:39:08 +00:00
Philip Withnall
8ef46818e3 Merge branch 'backport-4415-dbus-leak-glib-2-82' into 'glib-2-82'
Backport !4415 “gdbus: Fix leak of method invocation when registering an object with closures” to glib-2-82

See merge request GNOME/glib!4417
2024-12-03 20:14:15 +00:00
Philip Withnall
8f7619e140 Merge branch 'backport-4415-dbus-leak-glib-2-82' into 'glib-2-82'
Backport !4415 “gdbus: Fix leak of method invocation when registering an object with closures” to glib-2-82

See merge request GNOME/glib!4417
2024-12-03 20:12:23 +00:00
Sebastian Dröge
77b50ce7d2 gdbus: Fix leak of method invocation when registering an object with closures
The invocation passed in is owned by the callback.
2024-12-02 18:39:00 +00:00
Emmanuele Bassi
339e06125e Merge branch 'backport-4398-refstring-disable-assert-fix-glib-2-82' into 'glib-2-82'
Backport !4398 “grefstring: Mark a variable as potentially unused” to glib-2-82

See merge request GNOME/glib!4400
2024-11-26 23:45:02 +00:00
Philip Withnall
f996d026af
grefstring: Mark a variable as potentially unused
It is unused when compiling with `G_DISABLE_ASSERT`. That’s fine, but we
definitely want the `g_hash_table_remove()` call to still be made.

Fixes this CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/4483098

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-11-14 12:55:20 +00:00
Philip Withnall
398bdd16dc Merge branch 'backport-4395-appmonitor-test-build-fix-glib-2-82' into 'glib-2-82'
Backport !4395 “appmonitor: Fix warning building test” to glib-2-82

See merge request GNOME/glib!4397
2024-11-13 14:39:10 +00:00
Bastien Nocera
f5c00f1656 appmonitor: Fix warning building test
gio/tests/appmonitor.c: In function ‘timeout_cb’:
gio/tests/appmonitor.c:95:14: warning: null pointer dereference [-Wnull-dereference]
   95 |   *timed_out = TRUE;
2024-11-13 13:45:26 +00:00
Emmanuele Bassi
3e74b0a3ea Merge branch 'backport-4232-refstring-race-glib-2-82' into 'glib-2-82'
Backport !4232 “refstring: Fix race between releasing and re-acquiring an interned GRefString” to glib-2-82

See merge request GNOME/glib!4388
2024-11-08 13:02:48 +00:00
Sebastian Dröge
79bfee1371
refstring: Fix race between releasing and re-acquiring an interned GRefString
There is a race between releasing and re-acquiring an interned
GRefString if this happens on two threads at the same time. This can
result in already freed memory to be returned from
g_ref_string_new_intern().

| Thread 1                       | Thread 2                      |
| ------------------------------ | ----------------------------- |
| g_ref_string_release()         | g_ref_string_new_intern()     |
| g_atomic_rc_box_release_full() | g_mutex_lock()                |
|                                | g_hash_table_lookup()         |
| remove_if_interned()           | g_ref_string_acquire()        |
| g_mutex_lock()                 | g_mutex_unlock()              |
| g_hash_table_remove()          |                               |
| g_mutex_unlock()               |                               |
| g_free()                       |                               |
|                                | return res; // this is freed  |

This use-after-free usually also gives a critical warning because
g_atomic_ref_count_inc() checks for the refcount having been 0
before incrementing.

It is not possible to safely implement weak references via garcbox.

To avoid this race do not implement weak references via garcbox but
instead implement the allocation of the string manually with a manually
managed reference count. This allows to safely resurrect the interned
string if the above race happens, and also avoids other races.

As a side-effect this also

  * reduces the allocation size in addition to the actual string length
    from 32 bytes to 16 bytes on 64 bit platforms and keeps it at 16 bytes
    on 32 bit platforms,

  * doesn't lock a mutex when freeing non-interned GRefStrings.

Cherry-pick to `glib-2-82`: Drop changes to `g_ref_string_equal()`,
which doesn’t exist on this branch.
2024-11-08 12:36:50 +00:00
Sebastian Dröge
546b15312f arcbox: Document that implementing weak references via the clear_func is not safe 2024-11-08 12:35:09 +00:00
Michael Catanzaro
de7779fbd3 Merge branch 'backport-4373-macos-ico-fix-glib-2-82' into 'glib-2-82'
Backport !4373 “macos: Remove extraous space from type identifier” to glib-2-82

See merge request GNOME/glib!4381
2024-11-04 17:58:10 +00:00
Arjan Molenaar
828ca6978a macos: Remove extraous space from type identifier 2024-11-04 17:06:31 +00:00
Michael Catanzaro
0fb140c035 Merge branch 'backport-4378-gio-tool-leaks-glib-2-82' into 'glib-2-82'
Backport !4378 “gio: Fix GFileEnumerator leaks in gio tools” to glib-2-82

See merge request GNOME/glib!4380
2024-11-04 16:09:17 +00:00
correctmost
2dd1395e05 gio: Fix GFileEnumerator leaks in gio tools 2024-11-04 15:41:56 +00:00
Michael Catanzaro
d23ca8c7db Merge branch 'backport-4350-glib-domain-fix-glib-2-82' into 'glib-2-82'
Backport !4350 “glib: Don't require GLIB_DOMAIN to be a NUL-terminated string” to glib-2-82

See merge request GNOME/glib!4370
2024-10-25 02:20:38 +00:00
Sebastian Dröge
ea790e0504 glib: Add test for handling of non-NUL terminated strings in default log handler 2024-10-24 21:43:45 +01:00
Sebastian Dröge
44fb7c5b54 glib: Make sure GLIB_OLD_LOG_API is a NUL-terminated string
Every usage in GLib ensures this but theoretically external code might
pass something else. As this is only meant to be used internally from
GLib, don't support the other case but at least avoid potential out of
bound reads.
2024-10-24 21:43:45 +01:00
Sebastian Dröge
5bc28aff95 glib: Don't require GLIB_DOMAIN to be a NUL-terminated string
The length might be passed explicitly in the field instead, and the
string might not have a NUL-terminator as happens for example when
passed from the Rust bindings.

This might lead to out of bounds reads.

Thanks to Sebastian Wiesner for noticing this.
2024-10-24 21:43:45 +01:00
Simon McVittie
7e4fcb4fa8 Merge branch 'backport-4356-tzdata-glib-2-82' into 'glib-2-82'
Backport !4356 “gdatetime test: Do not assume PST8PDT was always exactly -8/-7” to glib-2-82

See merge request GNOME/glib!4357
2024-10-18 11:53:31 +00:00
Simon McVittie
0b12ce089e gdatetime test: Fall back if legacy System V PST8PDT is not available
On recent versions of Debian, PST8PDT is part of the tzdata-legacy
package, which is not always installed and might disappear in future.
Successfully tested with and without tzdata-legacy on Debian unstable.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-18 12:09:32 +01:00
Simon McVittie
44287620ba gdatetime test: Try to make PST8PDT test more obviously correct
Instead of using timestamp 0 as a magic number (in this case interpreted
as 1970-01-01T00:00:00-08:00), calculate a timestamp from a recent
year/month/day in winter, in this case 2024-01-01T00:00:00-08:00.

Similarly, instead of using a timestamp 15 million seconds later
(1970-06-23T15:40:00-07:00), calculate a timestamp from a recent
year/month/day in summer, in this case 2024-07-01T00:00:00-07:00.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-18 12:09:32 +01:00
Rebecca N. Palmer
57fa3b16a7 gdatetime test: Do not assume PST8PDT was always exactly -8/-7
In newer tzdata, it is an alias for America/Los_Angeles, which has a
slightly different meaning: DST did not exist there before 1883. As a
result, we can no longer hard-code the knowledge that interval 0 is
standard time and interval 1 is summer time, and instead we need to look
up the correct intervals from known timestamps.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3502
Bug-Debian: https://bugs.debian.org/1084190
[smcv: expand commit message, fix whitespace]
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-18 12:09:31 +01:00
Philip Withnall
45b469ea32
2.82.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-17 12:08:41 +01:00
Michael Catanzaro
e1f33e5559 Merge branch 'backport-4348-data-input-stream-read-line-utf8-fix-glib-2-82' into 'glib-2-82'
Backport !4348 “gdatainputstream: Fix length return value on UTF-8 validation failure“ to glib-2-82

See merge request GNOME/glib!4349
2024-10-12 18:34:44 +00:00
Philip Withnall
048a0f73e9
gdatainputstream: Fix length return value on UTF-8 validation failure
The method was correctly returning an error from
`g_data_input_stream_read_line_utf8()` if the line contained invalid
UTF-8, but it wasn’t correctly setting the returned line length to 0.
This could have caused problems if callers were basing subsequent logic
on the length and not the return value nullness or `GError`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

oss-fuzz#372819437
2024-10-12 13:33:15 +01:00
Philip Withnall
38000eb9a0
tests: Use g_assert_*() rather than g_assert() in GDataInputStream tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-12 13:33:07 +01:00
Michael Catanzaro
552be8a551 Merge branch 'backport-4333-macos-multicast-glib-2-82' into 'glib-2-82'
Backport !4333 “gio: Fix multicast iface selection on macOS” to glib-2-82

See merge request GNOME/glib!4336
2024-10-07 21:54:46 +00:00
Nirbheek Chauhan
3b1f313837 gio: Fix multicast iface selection on macOS
ip_mreqn.imr_ifindex is not used correctly by the XNU kernel, and
causes us to bind to the default interface; so fallback to ip_mreq
and set the iface source address (not SSM).

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/3489
2024-10-07 15:13:33 +01:00
Michael Catanzaro
2b08f0bd0b Merge branch 'backport-4176-openuri-leak-fix-glib-2-82' into 'glib-2-82'
Backport !4176 “gopenuriportal: Fix two memory leaks” to glib-2-82

See merge request GNOME/glib!4325
2024-10-01 18:03:49 +00:00
Julian Sparber
3487dc6cea gopenuriportal: Fix two memory leaks 2024-10-01 18:52:11 +01:00
Michael Catanzaro
998363d1bc Merge branch 'backport-4312-osx-appinfo-fix-glib-2-82' into 'glib-2-82'
Backport !4312 “macos: Fix URL launcher” to glib-2-82

See merge request GNOME/glib!4314
2024-09-28 18:27:16 +00:00
Arjan Molenaar
f78ffa53e6 macos: Fix URL launcher
URLs should be provided to the AppInfo.launch_uris() function.
2024-09-28 18:21:48 +01:00
Michael Catanzaro
41e92f4bdb Merge branch 'backport-4291-gvariant-analyzer-glib-2-82' into 'glib-2-82'
Backport !4291 “glib/gvariant: Fix check for G_ANALYZER_ANALYZING” to glib-2-82

See merge request GNOME/glib!4306
2024-09-25 16:08:52 +00:00
Philip Withnall
2f4607a6f1
gdbusdaemon: Fix check for G_ANALYZER_ANALYZING
As with the previous commit, this is _always_ defined in `gmacros.h`
and therefore the `#ifndef` will always be 0 even if disabled.
Just use `#if` instead.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-09-25 15:43:15 +01:00
Christian Hergert
800222c3c2 glib/gvariant: Fix check for G_ANALYZER_ANALYZING
This is _always_ defined in gmacros.h and therefore the #ifdef will always
be 1 even if were disabled. Just #if instead.

Closes: #3480
2024-09-25 15:43:11 +01:00
Philip Withnall
c6e8365133 Merge branch 'catalan' into 'glib-2-82'
Update Catalan translation

See merge request GNOME/glib!4285
2024-09-24 14:49:48 +00:00
Jordi Mas
d0cab59002 Update Catalan translation 2024-09-21 08:20:53 +02:00