Commit Graph

32174 Commits

Author SHA1 Message Date
Marco Trevisan
ed36f4c642 Merge branch 'wip/suppress-missing-lock-coverity' into 'main'
gdbus-codegen: Supress coverity warning in skeleton finalization

See merge request GNOME/glib!4825
2025-09-21 13:35:26 +02:00
Carlos Garnacho
592082ef1d gdbus-codegen: Supress coverity warning in skeleton finalization
This commit has the potential to close a thousand Coverity issues.
On generated code from gdbus-codegen, Coverity typically warns on
skeleton->priv->changed_properties_idle_source happening outside
the skeleketon->priv->lock during finalize(), while it's protected
by this mutex in other parts.

Presumably if the object is in finalization, there should be no
other threads poking at it, so the code is actually safe for the
intended use and the warning moot.

To address this, change gdbus-codegen to prefer g_clear_pointer()
with glib >= 2.38 (should be most often the case nowadays) so this
access is reserved to a single line of code, and mark this line of
code with a Coverity code annotation in order to suppress the
warning.
2025-09-21 12:02:58 +02:00
Philip Withnall
e04e8cac51 Merge branch 'wip/smcv/debbug1115617' into 'main'
gio/tests: Fix a race condition in /gdbus/connection/flush

See merge request GNOME/glib!4820
2025-09-19 13:49:54 +00:00
Simon McVittie
67dc482f8a gio/tests: Wait up to 10 seconds for a signal to be received
If the build/test machine is slow, heavily-loaded or otherwise
inconvenienced, it might take a few seconds for the signal to be sent
by the subprocess, received by the message bus, re-broadcasted by the
message bus and received by the test code. Wait a few more seconds
before giving up.

If this test is successful, increasing this timeout will not slow it
down: we stop waiting for the signal as soon as we receive it. This will
only make any difference if the test would have failed.

Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:37 +01:00
Simon McVittie
73224802b3 gio/tests: Convert the time to wait for expected signal into a constant
No functional change.

Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:30 +01:00
Simon McVittie
0960e72b07 gio/tests: Avoid a race condition
We have two things happening in parallel:

1. The GDBus worker thread writes out an AddMatch call to the socket,
   the message bus reads that method call from the other end of the
   socket, and the message bus responds by adding the match rule
   for the signal subscription

2. The main thread forks, and the child execs
   gdbus-connection-flush-helper, which sends the signal that we are
   expecting; the message bus receives that signal, and broadcasts it
   to subscribers, if any

Normally (1.) wins the race because exec'ing a child process is more
time-consuming than IPC, and the test passes.

However, it is possible for (2.) to win the race. If so, we will never
receive the expected signal (because it was received by the message bus
before the AddMatch() method call, so at the time it was received, the
test was not yet a subscriber); the test waits until the timeout and
then gives up, and the test fails.

For whatever reason, Debian's s390x buildd seems to be reliably failing
this test since this week, having previously passed. I don't know what
changed. I can (very rarely) reproduce the race condition described
above on a developer-accessible s390x machine by repeatedly running the
/gdbus/connection/flush test in a loop.

Bug-Debian: https://bugs.debian.org/1115617
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:23 +01:00
Simon McVittie
ac7275b185 gio/tests: Factor out connection_wait_for_bus() from gdbus-subscribe
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:05 +01:00
Philip Withnall
4f07891f1f Merge branch 'strfuncs_join_oob' into 'main'
strfuncs: Check for overflows when joining strings

See merge request GNOME/glib!4816
2025-09-18 15:51:31 +00:00
Philip Withnall
68c4b3b45c Merge branch 'fix_3785' into 'main'
gio-tool-trash: Report error when emptying the trash

Closes #3785

See merge request GNOME/glib!4818
2025-09-18 15:11:47 +00:00
Lukáš Tyrychtr
4ab0357974 gio-tool-trash: Report error when emptying the trash
This adds error reporting and proper exit code when emptying the trash fails
for some (mainly permission) related error.

Fixes #3785.
2025-09-18 15:11:47 +00:00
Tobias Stoeckmann
3719ac8db7 strfuncs: Check for overflows when joining strings
The functions g_strconcat, g_strjoinv and g_strjoin perform the
concatination of strings in two phases. The first phase figures out the
required amount of memory to hold the resulting string. The second
phase actually copies the strings into the allocated memory.

If the sum of the lengths of all strings to be joined exceeds G_SIZEMAX,
then phase two triggers an out of boundary write due to insufficient
amount of memory allocated.

While this sounds impossible to do at first, actually it becomes a
possibility on 32 bit systems with merely 20 MB of heap. The overflow
can actually happen if the same string is joined multiple times. See
attached unit test. While the same can be done with 64 bit systems, it
takes much more memory and a lot of time.

Fortunately the protection is rather cheap, although it adds two or
three machine instructions and branches due to testing.
2025-09-18 17:00:28 +02:00
Philip Withnall
d67aa209e2 Merge branch 'constructor-annotations' into 'main'
Mark a couple of functions as constructors and not methods

See merge request GNOME/glib!4817
2025-09-18 11:53:50 +00:00
Sebastian Dröge
a6727dfde8 Mark a couple of functions as constructors and not methods 2025-09-18 11:13:48 +03:00
Philip Withnall
9428157e08 Merge branch 'unicode17' into 'main'
gunicode: Update the code for Unicode 17.0.0

See merge request GNOME/glib!4793
2025-09-17 10:53:10 +00:00
Peng Wu
4dace3e026 gunicode: Update to Unicode 17.0.0
All changes mechanically generated with:
```
./tools/update-unicode-data.sh ~/Downloads/UCD 17.0.0
```
using the data from https://www.unicode.org/Public/17.0.0/ucd/UCD.zip.

Signed-off-by: Peng Wu <pwu@redhat.com>
2025-09-17 10:25:40 +01:00
Peng Wu
a211ea641a gunicode: Update the test case for Unicode 17.0.0 2025-09-17 10:25:40 +01:00
Peng Wu
cc85da3134 gunicode: Add some scripts and line break for Unicode 17.0.0
Co-authored-by: Philip Withnall <philip@tecnocode.co.uk>
2025-09-17 10:25:40 +01:00
Philip Withnall
edcd318f21 Merge branch 'glist-gslist-nullable-param-docs' into 'main'
Add missing "nullable" to parameter docs of GList/GSList

See merge request GNOME/glib!4807
2025-09-17 09:20:49 +00:00
Philip Withnall
86cd3cc097 Merge branch 'update-sr-translation' into 'main'
Update Serbian translation

See merge request GNOME/glib!4813
2025-09-17 08:05:44 +00:00
Philip Withnall
b7e4751b62 Merge branch 'main' into 'main'
Update Esperanto translation

See merge request GNOME/glib!4811
2025-09-17 08:03:02 +00:00
Kristjan ESPERANTO
066631e25d Update Esperanto translation 2025-09-17 08:02:17 +02:00
Marco Trevisan
290839a3b8 Merge branch 'gutils_unlocked' into 'main'
gutils: Mark load_user_special_dirs unlocked

See merge request GNOME/glib!4810
2025-09-17 00:07:42 +02:00
Милош Поповић
dd79c0f8a5 Update Serbian translation 2025-09-16 23:28:38 +02:00
Tobias Stoeckmann
1daef51682 gutils: Fix file name in comment
The implementation can be found in gosxutils.m.
2025-09-16 19:26:09 +02:00
Tobias Stoeckmann
2515357d79 gutils: Mark load_user_special_dirs unlocked
The load_user_special_dirs function performs no internal locking, which
means that callers must already hold the g_utils_global lock. Since we
mark some getters as unlocked by now, do the same with
load_user_special_dirs to highlight this additional requirement.

Suggested by Michael Catanzaro
2025-09-16 19:26:06 +02:00
Michael Catanzaro
355996f241 Merge branch 'gutils_special_dirs_leak' into 'main'
gutils: Handle singletons in unlocked functions

Closes #3784

See merge request GNOME/glib!4808
2025-09-16 11:21:53 -05:00
Philip Withnall
1d37756f64 Merge branch 'ghash_size_uint' into 'main'
ghash: Fix data type related issues

Closes #672

See merge request GNOME/glib!4783
2025-09-16 16:14:41 +00:00
Tobias Stoeckmann
18a7e7b4a2 gutils: Handle singletons in unlocked functions
Make sure that results of build functions are stored in singletons to
avoid creating multiple instances which eventually could leak.

Fixes: #3784
2025-09-16 17:38:11 +02:00
ousnius
53020be335 Add missing "nullable" to parameter docs of GList/GSList
The list pointer is allowed to be null while still creating a new valid list.

The missing "nullable" flagging can cause issues in gir generated wrappers.
See https://github.com/gircore/gir.core/issues/1318

List of functions with changed comments:
- g_list_append
- g_list_prepend
- g_list_insert
- g_list_insert_before
- g_slist_append
- g_slist_prepend
- g_slist_insert
- g_slist_insert_before
2025-09-16 17:12:58 +02:00
Philip Withnall
8ca55d6524 Merge branch 'meson-add-arguments-to-all-c-like-languages' into 'main'
Meson: Add arguments and defines to all C-like languages

See merge request GNOME/glib!4795
2025-09-16 15:04:12 +00:00
Luca Bacci
b7f29c11bd meson: Add arguments and defines to all C-like languages
...C, C++, ObjC, and ObjC++ too. It's not a problem to add
arguments to unused languages.

This means, for example, that all the defines are in place when writing
WinRT C++ code.
2025-09-16 15:22:28 +01:00
Philip Withnall
8830f7286e Merge branch 'genum-class-values-array-length' into 'main'
Add missing `(array length=n_values)` annotation to `GEnumClass` / `GFlagsClass`

See merge request GNOME/glib!4803
2025-09-16 14:21:17 +00:00
Philip Withnall
a8b9c237cf Merge branch 'gdbus-register-error-domain-out-annotation' into 'main'
GDBus: Add `(out)` annotation to quark in g_dbus_error_register_error_domain()

See merge request GNOME/glib!4798
2025-09-16 14:20:58 +00:00
Philip Withnall
aa04e30883 Merge branch 'gstring_replace_guint' into 'main'
gstring: Support large strings in g_string_replace

See merge request GNOME/glib!4790
2025-09-16 14:20:01 +00:00
Philip Withnall
0ea8880468 Merge branch 'ci-msys2-use-meson-coverage-option' into 'main'
CI/MSYS2: Use builtin b_coverage option

See merge request GNOME/glib!4794
2025-09-16 14:19:44 +00:00
Philip Withnall
3691e4d3d7 Merge branch 'win32-app-info-co-allow-set-foreground-window' into 'main'
GWin32AppInfo: Allow focus-stealing when requested via GAppLaunchContext

See merge request GNOME/glib!4759
2025-09-16 14:19:21 +00:00
Philip Withnall
3d0c3bfae8 Merge branch '3771-keyfile-invalid-escapes' into 'main'
gdesktopappinfo: Error out on more invalid desktop files

Closes #3771

See merge request GNOME/glib!4766
2025-09-16 14:18:58 +00:00
Philip Withnall
5b9f3fb947 Merge branch 'version-bump' into 'main'
build: Post-release version bump

See merge request GNOME/glib!4806
2025-09-16 11:44:44 +00:00
Philip Withnall
050bb48775 build: Post-release version bump
This opens up the development cycle for 2.88.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-16 11:56:29 +01:00
Philip Withnall
958a0bccbe Merge branch 'help-width' into 'main'
get_help(): Ignore width of invisible options

Closes #3781

See merge request GNOME/glib!4801
2025-09-16 10:51:14 +00:00
FeRD (Frank Dana)
bff4dcb3d8 get_help(): Ignore width of invisible options
When get_help() gets ready to lay out the help text into columns,
it first goes through and computes the max_width of the strings in
the left column. Problem is, it measures the width of every
available option, whether or not they'll actually be displayed.

Instead, let's use the same criteria used when deciding whether
to display an option, to decide whether or not to account for it
when computing max_width. This way, the layout is sized for the
help that's actually being produced.

Fixes #3781
2025-09-16 11:20:17 +01:00
Philip Withnall
c091c3e3f1 Merge branch 'fuzzing_special_dirs' into 'main'
fuzzing: Fix fuzz_special_dirs

Closes #3783

See merge request GNOME/glib!4804
2025-09-16 08:44:04 +00:00
Tobias Stoeckmann
0bebad35cf fuzzing: Fix fuzz_special_dirs
Always NUL-terminate the data, which g_file_get_contents does as well.
This fixes unnecessary fuzzer warnings.

For further clarification of this requirement, rename the internally
used function.

Fixes: #3783
2025-09-16 10:28:14 +02:00
Philip Withnall
c31c4a5259 Merge branch 'special_dirs' into 'main'
gutils: Improve load_user_special_dirs' user-dirs.dirs parser

See merge request GNOME/glib!4800
2025-09-15 22:57:44 +00:00
Tobias Stoeckmann
ed594d819e fuzzing: add special dirs fuzzing test
Split custom user-dirs.dirs parser into its own gutilsprivate.c file
for easier fuzzing support and add a fuzzing test.
2025-09-16 00:08:17 +02:00
Tobias Stoeckmann
300722b6c4 gutils: Handle huge lines in load_user_special_dirs
If a line is longer than G_INTMAX, still treat it correctly without
possibly provoking an out of boundary read.
2025-09-15 17:21:16 +02:00
Tobias Stoeckmann
9a2d221e90 gutils: Reject unquoted entries in load_user_special_dirs
If the end quote is missing, reject the entry. Please note that this
still allows entries with an uneven amount of quotes, e.g. "/"".
2025-09-15 17:21:16 +02:00
Tobias Stoeckmann
43d9e50654 gutils: Strip all trailing slahes in load_user_special_dirs
Do what the comment states and strip all trailing slashes. Also, do not
strip the trailing slash if it's the only character left, i.e. if it
denotes the root directory.
2025-09-15 17:21:16 +02:00
Tobias Stoeckmann
2e88bd5fdd gutils: Only allow $HOME in load_user_special_dirs
Make sure that the allowed environment variable is actually HOME, not
any environment variable starting with HOME, e.g. HOMER.
2025-09-15 17:21:13 +02:00
Sebastian Dröge
2e3e3c8025 Add missing (array length=n_values) annotation to GEnumClass / GFlagsClass 2025-09-15 13:41:20 +03:00