Commit Graph

32050 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
10366ac62f girepository: Add checks on prerequisites of gi_repository_require 2025-08-29 14:29:58 +02:00
Marco Trevisan (Treviño)
fd262e72f5 girepository: Fix indentation 2025-08-29 14:29:58 +02:00
Marco Trevisan (Treviño)
a1bc53aa98 girepository: Add test ensuring that platform specific methods are available 2025-08-29 14:29:33 +02:00
Emmanuele Bassi
db96cb45ce Remove backward compatibility introspection from Gio-2.0
The identifiers and types in Gio-2.0 that are used for backward
compatibility purposes in order to keep code importing Gio and using
platform-specific API are actually breaking the platform-specific
introspection data, because the introspection scanner favours types
found inside dependencies as opposed to types with the same name found
inside the current namespace.

In practice, the backward compatibility hack of keeping duplicate types
inside Gio-2.0 is effectively preventing people from using GioUnix-2.0
and GioWin32-2.0.

We cannot change the introspection scanner, because that could have
unforeseen results across the stack.

We cannot remove the symbols and bump the namespace version of Gio and
friends to 3.0, unless we keep generating known-to-be-broken 2.0
versions of all the namespaces. It also won't solve the issue of code
loading Gio without specifying a version, because that always imples
using the latest version of the namespace, which means backward
compatibility would still need an explicit opt in.

In practice, the only reasonable way forward is to break backward
compatibility, and remove the duplicate symbols and identifiers from
Gio-2.0, as we should have done in the first place.

Fixes: #3744
2025-08-29 14:02:44 +02:00
Marco Trevisan (Treviño)
8f25f70fc9 girepository: Always use internal functions in internal implementations
We are going to have a different logic in the public function so let's
just use the same code internally
2025-08-29 14:02:44 +02:00
Philip Withnall
0a017b39c2 Merge branch 'update-sv-translation' into 'main'
Update Swedish translation

See merge request GNOME/glib!4758
2025-08-27 14:18:03 +00:00
Philip Withnall
fa46da5804 Merge branch 'piotrdrag/pl-translation-250825' into 'main'
Update Polish translation 250825

See merge request GNOME/glib!4754
2025-08-26 19:17:52 +00:00
Anders Jonsson
c0c00844ae Update Swedish translation 2025-08-26 21:11:21 +02:00
Marco Trevisan
1e7fab4065 Merge branch '3768-test-trap-subprocess-flags' into 'main'
gtestutils: Fix G_TEST_SUBPROCESS_INHERIT_STDIN in g_test_trap_subprocess()

Closes #3768

See merge request GNOME/glib!4757
2025-08-26 17:14:00 +02:00
Philip Withnall
2f737c4e79 gtestutils: Fix G_TEST_SUBPROCESS_INHERIT_STDIN in g_test_trap_subprocess()
Spotted by Vincent Fazio. The old flag value was incorrectly used
instead of the new one when testing to see which flags were set. Likely
a typo.

This will never have worked, because the first few lines of the function
assert that the old flag value is not set.

Includes a unit test so we don’t regress on this in future.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Reported-by: Vincent Fazio <vfazio@gmail.com>

Fixes: #3768
2025-08-26 15:56:56 +01:00
Piotr Drąg
073135b8c9 Update Polish translation 2025-08-25 18:23:15 +02:00
Michael Catanzaro
2735b2b331 Merge branch 'strv-docs-example' into 'main'
gtestutils: Fix a slightly broken example in a doc comment

See merge request GNOME/glib!4751
2025-08-22 10:36:02 -05:00
Philip Withnall
354344fe59 2.85.4
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.85.4
2025-08-22 13:29:34 +01:00
Philip Withnall
c8c3c7f5bd Merge branch 'sl-po' into 'main'
Update Slovenian translation

Closes #3766

See merge request GNOME/glib!4752
2025-08-22 12:09:38 +00:00
Martin
9b11cc0900 Update Slovenian translation
Submitted at https://gitlab.gnome.org/GNOME/glib/-/issues/3766,
committed by Philip Withnall.

Fixes: #3766
2025-08-22 12:52:19 +01:00
Philip Withnall
3894bec664 gtestutils: Fix a slightly broken example in a doc comment
`GStrv` can only be used with `g_auto`, not `g_autoptr`.

Guess who just copied and pasted this code example and found it didn’t
compile?

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-08-21 21:17:07 +01:00
Philip Withnall
b026819ca1 Merge branch 'windows-skip-socket-mock' into 'main'
tests/gio: skip Unix socket-mock tests on Windows

See merge request GNOME/glib!4744
2025-08-21 14:31:24 +00:00
Philip Withnall
5e8cc2559d Merge branch 'gmessage_recursion' into 'main'
gmessages: Fix stack overflow with many fields

Closes #3760

See merge request GNOME/glib!4750
2025-08-21 14:29:35 +00:00
Philip Withnall
2aac71dc33 Merge branch 'ghash_3724' into 'main'
ghash: Handle hash tables with millions of entries

Closes #3724

See merge request GNOME/glib!4749
2025-08-21 14:26:46 +00:00
Tobias Stoeckmann
c8730c7e8c gmessages: Avoid magic numbers
Use G_N_ELEMENTS macro to show exactly what these numbers 16 and 32 mean
in context of g_log_structured function.

Suggested by Marco Trevisan
2025-08-21 16:11:53 +02:00
Tobias Stoeckmann
e229be8f32 gmessages: Fix stack overflow with many fields
If g_log_structured is called recursively with more than 16 fields,
then n_fields is larger than the stack array, leading to an eventual
read overflow into the message buffer.

Either the message can be properly prepared by an attacker or many
bytes are left uninitialized (and potentially prepared through
previous function calls by the attacker), which could lead to
information leaks through logs.

Since such a recursive overflow can only be triggered with test
code (or users explicitly supplying G_LOG_FLAG_RECURSION), this is
no security threat.

Closes #3760
2025-08-21 16:10:16 +02:00
Tobias Stoeckmann
b32aed174a ghash: Call g_error if hash table grows too large
Gracefully handle the case when too many items (billions) are added to a
hash table.
2025-08-21 10:47:32 +02:00
Tobias Stoeckmann
4bc794e42a ghash: Handle hash tables with millions of entries
Multiplying a guint value with BIG_ENTRY_SIZE (8) can overflow the guint
data type if size reaches 2^29. Use the correct size_t type for 64 bit
systems to support such allocations.

A 32 bit system should fail its reallocation way earlier before reaching
such a large "size", i.e. item count, especially when reallocating.
Also, it would multiply with 4.

Closes #3724
2025-08-21 10:47:31 +02:00
Michael Catanzaro
08872dcd47 Merge branch 'constructor-private-add-attribute-used' into 'main'
gconstructor: Add attribute used for TLS callback pointer

See merge request GNOME/glib!4748
2025-08-20 10:43:26 -05:00
Luca Bacci
004ff59828 gconstructor: Add attribute used for TLS callback pointer
This is needed to ensure that the pointer is not removed
by an optimization pass. Theoretically, we'd have to add
both 'used' and 'retain' attributes, however for PE targets
'used' includes the effect of 'retain' [1], and GCC warns
if 'retain' is used in PE targets.

Fixes the constructor test in LTO builds.

[1] https://reviews.llvm.org/D96838
2025-08-20 14:00:38 +02:00
Marco Trevisan
99886f2d66 Merge branch 'utf8-gir-fix' into 'main'
gutf8: add introspection type for `end` parameter of `validate*` fn's

Closes #3743

See merge request GNOME/glib!4745
2025-08-20 02:16:12 +02:00
two
98a3dcb7e0 Merge branch glib:main into utf8-gir-fix 2025-08-19 21:13:09 +00:00
Michael Catanzaro
8df43f04ae Merge branch 'tests-printf-enhancements' into 'main'
tests/printf: Use proper compare helper for unsigned types

See merge request GNOME/glib!4747
2025-08-19 12:13:14 -05:00
Luca Bacci
d1dd177fe8 tests/printf: Use proper compare helper for unsigned types 2025-08-19 18:55:20 +02:00
Philip Withnall
aded48134d Merge branch 'revert-use-g-fputs-in-g-printf' into 'main'
Revert "Use g_fputs in g_printf, g_fprintf"

Closes #3761

See merge request GNOME/glib!4746
2025-08-19 16:19:18 +00:00
Luca Bacci
bb96c606ae tests/printf: Produce strings with embedded null characters
See #3761
2025-08-19 17:51:00 +02:00
Philip Withnall
e07cd77b37 Merge branch 'gmain-docs' into 'main'
gmain: Reformat docs to fully use gi-docgen and match style guide

See merge request GNOME/glib!4714
2025-08-19 14:30:45 +00:00
Philip Withnall
be12b1a200 gmain: Reformat docs to fully use gi-docgen and match style guide
https://developer.gnome.org/documentation/guidelines/devel-docs.html#writing-api-references

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3250
2025-08-19 15:01:39 +01:00
Zhou Qiankang
9c1226223c tests/gio: skip Unix socket-mock tests on Windows
Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
2025-08-19 21:31:13 +08:00
Philip Withnall
b6c2a877e2 gmain: Add (not nullable) to g_main_context_ref_thread_default()
This might be the default, but let’s be explicit about it, since the
non-nullability of the return value is explicitly mentioned in the prose
of the documentation.

This contrasts with the `(nullable)` on the return value of
`g_main_context_get_thread_default()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-08-19 12:54:12 +01:00
Philip Withnall
1778e412a4 gmain: Add a couple of missing (nullable) annotations
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-08-19 12:54:06 +01:00
Philip Withnall
33c009676f gmain: Add missing (transfer full) annotations to constructors
These might be the implicit default for constructors, but it’s clearer
to be explicit about them.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-08-19 12:54:00 +01:00
two
3ecbd2f4ab gutf8: add introspection type for end parameter of validate* fn's
actually @pwithnall thought about how to fix it, i just tested and committed it

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3743
2025-08-19 11:14:31 +00:00
Luca Bacci
8a7365c0b3 Revert "Use g_fputs in g_printf, g_fprintf"
This reverts commit 02c63162a4
and sets the glib/print test as can_fail on Windows.

Fixes #3761
2025-08-19 11:05:09 +02:00
Philip Withnall
c4daaf9c93 Merge branch 'garray_binsearch_doc' into 'main'
garray: Fix g_array_binary_search description

See merge request GNOME/glib!4742
2025-08-18 15:24:13 +00:00
Philip Withnall
f00f68dcd4 Merge branch 'mimeapps-respect-symlinks' into 'main'
glib: respect symlinks when updating mimeapps.list

Closes #3579

See merge request GNOME/glib!4673
2025-08-18 13:44:23 +00:00
Rafael Girão
ce3a5dbbbe glib: respect symlinks when updating mimeapps.list
In the case where mimeapps.list is a symlink, gio-issued updates would
overwrite the file, destroying the symlink in the process.

Instead, this approach recursively follows mimeapps.list symlinks
and overwites the contents of the final file instead.

Closes #3579
2025-08-18 13:44:23 +00:00
Tobias Stoeckmann
aff998caf1 garray: extend test_array_binary_search
Add invalid input to highlight that arrays which are not absolutely
sorted according to the comparison function are not supported.
2025-08-14 19:14:09 +02:00
Philip Withnall
2c08654b62 Merge branch 'main' into 'main'
Update Russian translation

See merge request GNOME/glib!4743
2025-08-14 12:53:22 +00:00
jtux270
4ab57c1920 Update Russian translation 2025-08-14 15:10:12 +03:00
Tobias Stoeckmann
980bcc4553 garray: Fix g_array_binary_search description
The g_array_binary_search function does not necessarily return the index
of the first instance within the array. If the sentence is read as "the
first encountered instance", then it would be correct but not helpful.

Drop the statement and keep the code as it is.
2025-08-13 18:07:30 +02:00
Michael Catanzaro
683633790b Merge branch '3758-memory-monitor-poll-weak-ref' into 'main'
gmemorymonitorpoll: Hold a weak ref from a source callback to the monitor

Closes #3758

See merge request GNOME/glib!4741
2025-08-12 14:48:26 -05:00
Philip Withnall
30aff12d89 gmemorymonitorpoll: Hold a weak ref from a source callback to the monitor
It’s possible for the dispatch of the timeout source to race with the
finalisation of the `GMemoryMonitorPoll`, given that the timeout is run
in the GLib worker thread.

Protect against that by holding a thread-safe weak ref on the
`GMemoryMonitor` in the callback data.

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

Fixes: #3758
2025-08-12 13:24:52 +01:00
Philip Withnall
453614325e Merge branch 'ref_unref_transfer_full' into 'main'
Annotate ref/unref functions as transfer full

See merge request GNOME/glib!4739
2025-08-12 09:08:48 +00:00
Philip Withnall
e63f6b228d Merge branch 'thaller-gobject-maintainer' into 'main'
docs: Add Thomas Haller as a co-maintainer of GObject

See merge request GNOME/glib!4738
2025-08-12 09:04:10 +00:00