Commit Graph

31847 Commits

Author SHA1 Message Date
Patrick Griffis
e419c1e10d inet-address: Ignore windows specific failure
In this case getaddrinfo on Windows succeeds at parsing something that fails on Linux.
2025-07-07 15:45:50 -05:00
Patrick Griffis
7e85ae9d5f ginetaddress: Scope ID parsing is not supported on win32
getaddrinfo doesn't parse it on Windows. This could be replaced by more manual parsing in the future.
2025-07-07 11:24:11 -05:00
Patrick Griffis
b40194865a Unify address parsing for GInetAddress and GInetSocketAddress
This allows scope-ids to work for GInetAddress
2025-07-03 16:53:52 -05:00
Patrick Griffis
ed8bae5483 socket-testclient: Fix leaking debug strings 2025-07-03 16:11:29 -05:00
Patrick Griffis
bb8281fa72 socket-testclient: Include scope-id in debug output 2025-07-03 16:11:29 -05:00
Patrick Griffis
984d5cb199 socket-testclient: Support connecting to IPv6 addresses
Each enumerated address can be of a different family type, so you have to make a socket after you have that information.

As this is just a test client we make a new socket each time for simplicity.
2025-07-03 11:05:23 -05:00
Patrick Griffis
d03f495b31 gsocketaddress: Set scope-id and flowinfo of ginetaddress 2025-07-03 11:05:23 -05:00
Patrick Griffis
73d0627bda ginetaddress: Add scope-id and flowinfo properties
This will be used by GResolver as DNS responses include this
information along with the address.
2025-07-03 11:05:23 -05:00
Philip Withnall
804553b126 Merge branch 'mcatanzaro/#3716' into 'main'
gfileutils: fix computation of temporary file name

Closes #3716

See merge request GNOME/glib!4674
2025-07-01 17:11:44 +00:00
Michael Catanzaro
61e9632848 gfileutils: fix computation of temporary file name
We need to ensure that the value we use to index into the letters array
is always positive.

Fixes #3716
2025-07-01 11:00:44 -05:00
Philip Withnall
db3c92d3ab Merge branch 'genum-annotations' into 'main'
Add missing `(array zero-terminated=1)` annotations

See merge request GNOME/glib!4669
2025-06-25 13:06:22 +00:00
Jan-Willem Harmannij
5b5c3f43a5 Add missing (array zero-terminated=1) annotations
Array annotations were missing on:
- g_enum_complete_type_info
- g_flags_complete_type_info
- g_type_module_register_enum
- g_type_module_register_flags
2025-06-22 23:00:50 +02:00
Philip Withnall
cf776d1ac6 Merge branch 'gsettings_closure' into 'main'
Incorrect output parameter handling in closure helper of g_settings_bind_with_mapping_closures

See merge request GNOME/glib!4667
2025-06-19 12:32:26 +00:00
Mark Nauwelaerts
bd20507909 gsettings: adjust closure helpers in g_settings_bind_with_mapping_closures
... to handle an output value parametere
2025-06-18 19:52:59 +02:00
Mark Nauwelaerts
9ee245b78e tests: gsettings: extend g_settings_bind_with_mapping_closures test
... so as to fail with current implementation
2025-06-17 18:18:40 +02:00
Philip Withnall
dc6f9447cd Merge branch 'g_match_info_fetch_pos_desc' into 'main'
docs: clarifying return values from g_match_info_fetch_pos

Closes #2848

See merge request GNOME/glib!4664
2025-06-17 13:07:04 +00:00
Mark Lautman
bd36359ed8 docs: clarifying return values from g_match_info_fetch_pos
Details the returned function value, start_pos, and end_pos for various scenarios of capture parenthesis and GMatchInfo.

Closes #2848
2025-06-17 13:07:04 +00:00
Philip Withnall
f0f1c64c5b Merge branch 'fix-do-not-queue-docs' into 'main'
gio: enums: Fix GBusNameOwnerFlags's annotation

See merge request GNOME/glib!4665
2025-06-17 10:39:46 +00:00
Maximiliano Sandoval
d02f59a54b gio: enums: Fix GBusNameOwnerFlags's annotation
g-ir-scanner won't pick Since or Deprecated annotations if they are
inlined, they need a dedicated documentation block for this to work. The
since annotation is used, e.g. in gtk-rs, to not expose enum flags if
not compiled declaring we have a new enough glib version.
2025-06-16 17:57:53 +02:00
Philip Withnall
c1e8174992 2.85.1
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.85.1
2025-06-13 12:28:00 +01:00
Philip Withnall
e897df0e45 Merge branch 'gio-unix-docs-fix' into 'main'
docs: Stop hiding the Unix-like APIs which are in Gio-2.0.gir

See merge request GNOME/glib!4657
2025-06-13 11:03:37 +00:00
Philip Withnall
96aa5f1b1f Merge branch 'check-recursive-trashing' into 'main'
glocalfile: Verify deleting from trash beforehand

Closes #1665

See merge request GNOME/glib!4653
2025-06-12 16:01:15 +00:00
Philip Withnall
0bd51d8f8b Merge branch 'meson-use-localedir-opt' into 'main'
meson: Use the appropriate localedir option

See merge request GNOME/glib!4661
2025-06-12 12:20:03 +00:00
Ignacy Kuchciński
181992ccb5 glocalfile: Verify deleting from trash beforehand
Verify that you can delete the file from the trash before moving it, if
the file is a directory owned by the user, recursively check for
non-empty directory not owned by he user.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1665
2025-06-12 13:26:22 +02:00
Kleis Auke Wolthuizen
0cbb5fb378 meson: Use the appropriate localedir option 2025-06-11 15:56:27 +02:00
Ignacy Kuchciński
2a7f28e88a glocalfile: Populate different statbuf for parent
Populate a different statbuf for the parent directory, so that we can
keep using file_state for the file we're removing later in the code.
2025-06-11 10:33:50 +02:00
Philip Withnall
50a35a4a81 Merge branch 'sync-gnulib' into 'main'
glib/gnulib/printf.c: Sync with gnulib

See merge request GNOME/glib!4560
2025-06-10 13:55:12 +00:00
Philip Withnall
d29cc3892f Merge branch 'make-sysprof-yield' into 'main'
Make the sysprof feature yield

See merge request GNOME/glib!4659
2025-06-09 12:53:11 +00:00
Matthias Clasen
c915502eb8 build: Make the sysprof feature yield
This is expected by other projects who use glib as a subproject,
and there is little point in making the option a feature unless
you inherit it.
2025-06-07 23:53:19 -04:00
Philip Withnall
a6445ee3c4 Merge branch 'mcatanzaro/gmarkup-documentation' into 'main'
gmarkup: make documentation more discoverable

See merge request GNOME/glib!4658
2025-06-03 14:00:15 +00:00
Michael Catanzaro
27aad582f2 gmarkup: make documentation more discoverable
There is a bunch of documentation in a separate markdown page that does
not appear in search results. We should point to it.

I think the restriction on not being used to process untrusted input
should be relaxed into something more permissive, like "should not be
used on untrusted input if you care about denial of service." But that
can be a problem for another day.
2025-06-03 14:00:15 +00:00
Philip Withnall
3d84aa264c docs: Stop hiding the Unix-like APIs which are in Gio-2.0.gir
There are four `Unix.+` classes in `Gio-2.0.gir` which need to be
exposed in the `Gio-2.0.gir` docs because they are actually now
cross-platform (which is a move which has caused a lot of pain).

Change the code which filters out the rest of the `Unix.+` classes to
ignore these ones. The rest of the classes continue to be documented via
`GioUnix-2.0.gir`.

Changing the regexs for this involved a fun use of negative lookahead.

See https://gitlab.gnome.org/GNOME/glib/-/issues/3697#note_2459405

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3697
2025-06-03 14:10:52 +01:00
Philip Withnall
36a34e0d33 Merge branch 'string-overflow-check' into 'main'
gstring: Fix overflow check when expanding the string

See merge request GNOME/glib!4655
2025-06-03 12:07:10 +00:00
Philip Withnall
33d9ba2fcc gstring: Fix overflow check when expanding the string
After commit 34b7992fd6 the overflow check
was only done when expanding the string, but we need to do it before
checking whether to expand the string, otherwise that calculation could
overflow and falsely decide that the string is big enough already.

As a concrete example, consider a `GString` which has:
 * `.len = G_MAXSIZE / 2 + 1`
 * `.allocated_len = G_MAXSIZE / 2 + 1`
and `g_string_append()` is called on it with an input string of length
`G_MAXSIZE / 2`.

This results in a call `g_string_maybe_expand (string, G_MAXSIZE / 2)`,
which calculates `string->len + len` as `(G_MAXSIZE / 2 + 1) +
(G_MAXSIZE / 2)` which evaluates to `1` as it overflows. This is not
greater than `string->allocated_len` (which is `G_MAXSIZE / 2 + 1`), so
`g_string_expand()` is *not* called, and `g_string_maybe_expand()`
returns successfully. The caller then assumes that there’s enough space
in the buffer, and happily continues to cause a buffer overflow.

It’s unlikely anyone could hit this in practice because it requires
ludicrously big strings and `GString` allocations, which likely would
have been blocked by other code, but if we’re going to have the overflow
checks in `GString` then they should be effective.

Spotted by code inspection.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-06-03 11:31:04 +01:00
Kleis Auke Wolthuizen
044df5b2bb glib/gnulib/printf.c: Sync with gnulib
Sync _g_gnulib_vsprintf() with lib/vszprintf.c and
_g_gnulib_vsnprintf() with lib/vsnzprintf.c from gnulib, plus adjust
the final guards to handle differing return signatures.

Highlights:
- Avoid a memory allocation if the result fits into the provided
  buffer.
  https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=f5200a50fa42fdaed40ecc67b27f41be328a6a01
- Don't assume vasnprintf returns EOVERFLOW if the size exceeds
  INT_MAX; do the check ourselves.
  https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=7e421d1cd6a8752aa527895c759a72a47203959a
2025-06-01 10:10:32 +02:00
Philip Withnall
8825c164ea Merge branch 'libglib-static-dep-for-tests' into 'main'
Meson: Add libglib_static dependency for use in tests

See merge request GNOME/glib!4651
2025-05-30 22:15:31 +00:00
Philip Withnall
80ca73f501 Merge branch 'mcatanzaro/string-test' into 'main'
Fix buffer overflow in string-test

See merge request GNOME/glib!4654
2025-05-30 21:03:38 +00:00
Michael Catanzaro
e585ea2a7d Fix buffer overflow in string-test
This string is 24 bytes long, not 25 bytes. This problem was noticed by
a bug hunter running the testsuite under address sanitizer.
2025-05-30 14:59:03 -05:00
Philip Withnall
c1ff515f09 Merge branch 'gregex_description_update' into 'main'
GRegex: update class description

See merge request GNOME/glib!4646
2025-05-30 11:39:50 +00:00
Mark Lautman
2ab485a472 GRegex: update class description
See merge request 4643
2025-05-30 11:39:50 +00:00
Philip Withnall
b7ce23703e Merge branch 'improve-gvaluesetboxed-docs' into 'main'
gobject: clarify in documentation that g_value_set_boxed copies

See merge request GNOME/glib!4652
2025-05-30 10:01:13 +00:00
Marco Trevisan
45869df93c Merge branch 'regex-docs' into 'main'
gregex: Clarify docs for end_pos

See merge request GNOME/glib!4645
2025-05-30 11:48:33 +02:00
Pablo Correa Gómez
bf24002428 gobject: clarify in documentation that g_value_set_boxed copies
This comes as a consequence of confusion by two devs[1]. The wording
is copied from g_value_set_string, which is more clear on what the
function is doing with the object it's consuming.

[1] https://gitlab.gnome.org/GNOME/Incubator/papers/-/merge_requests/467#note_2455770
2025-05-29 23:46:19 +02:00
Luca Bacci
e2dfe27996 Add specific test for private functions 2025-05-29 16:45:39 +02:00
Luca Bacci
08a79f4465 Meson: Enable tests for internal functions 2025-05-29 16:45:39 +02:00
Luca Bacci
5cc32c35f9 Meson: Add glib static dependency
This dependency can be used to link with GLib object files.
2025-05-29 16:45:33 +02:00
Philip Withnall
2db24eeef0 Merge branch 'fopen-cloexec' into 'main'
gstdio: Add support for the `e` flag (O_CLOEXEC) to g_fopen()

See merge request GNOME/glib!4564
2025-05-29 10:59:56 +00:00
Luca Bacci
f2b98de002 Use TLS callback also for shared library builds
This way things just work even if the compiled object
files are used in tests.
2025-05-29 12:41:29 +02:00
Philip Withnall
b2f0bb9592 tests: Expand PATH for Python tests on Windows
This works around a Meson bug
(https://github.com/mesonbuild/meson/issues/4668).

If we have a Python test which spawns a built native binary, that binary is
listed in the `depends` argument of the `test()`. On Linux, this results in
the directories containing the built libraries which the binary depends on
being added to the `LD_LIBRARY_PATH` of the test invocation. On Windows,
however, Meson currently doesn’t add those directories to `PATH` (which is
the equivalent of `LD_LIBRARY_PATH`), so we have to do it manually.

This takes the same approach as Christoph Reiter did in
gobject-introspection
(13e8c7ff80/tests/meson.build (L2)).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-05-28 16:10:55 +01:00
Philip Withnall
306abedea5 tests: Add tests for new e modes for g_fopen()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-05-28 16:10:48 +01:00