Commit Graph

8922 Commits

Author SHA1 Message Date
tytan652
9335698b87 gdbusconnection: Allow creating connection with cross-namespace 2024-11-25 17:42:27 +01:00
Philip Withnall
2b155f86dd Merge branch 'update-macos-min' into 'main'
Raise minimum supported macOS version to 10.13 (High Sierra)

Closes #3441

See merge request GNOME/glib!4405
2024-11-21 11:13:04 +00:00
John Ralls
9bbb1acd7d Raise minimum supported macOS version to 10.13 (High Sierra).
Allows removing all macOS version ifdefs.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/3441
2024-11-20 18:15:34 -08:00
Philip Withnall
ccee4c2342 Merge branch 'feature/gresource-static-validate-args' into 'main'
gio/gresource: validate args of g_static_resource_init

Closes #3517

See merge request GNOME/glib!4372
2024-11-19 18:10:18 +00:00
Philip Withnall
dfe252429c Merge branch 'uninstalled_variables' into 'main'
meson: Add variables to -uninstalled.pc files

See merge request GNOME/glib!4399
2024-11-19 12:01:06 +00:00
Sebastian Geiger
ccf4403e39 gio/gresource: validate args of g_static_resource_init
Signed-off-by: Sebastian Geiger <sbastig@gmx.net>
2024-11-17 13:18:06 +01:00
Benjamin Otte
33b9338fb0 converteroutputstream: Raise error for data at end
When a conversion is finished, the code would return 0 from its write
vfunc. This is disallowed by the API of g_output_stream_write() and
causes g_output_stream_splice() as used by g_converter_convert_bytes()
to turn into an infinite loop.

Instead, raise a G_IO_ERROR_MESSAGE_TOO_LARGE error so that the calling
code can decide how to deal with it.

Testcase included.

Closes #3532
2024-11-16 07:46:24 +00:00
Xavier Claessens
0b776bc20c meson: Add variables to -uninstalled.pc files
This allows building a glib project within glib's devenv. Otherwise
Meson won't find glib tools.
2024-11-13 11:07:12 -05:00
Philip Withnall
7dacfa7799 Merge branch 'wip/hadess/test-warning-fix' into 'main'
appmonitor: Fix warning building test

See merge request GNOME/glib!4395
2024-11-13 13:40:45 +00:00
Gleb Popov
6d67568da3 Replace procfs linuxism with kinfo freebsdism 2024-11-13 13:29:01 +00:00
Bastien Nocera
48b980ca7d 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 14:24:50 +01:00
Arjan Molenaar
6e4b70e062 macos: content-type tests should succeed 2024-11-09 13:42:47 +01:00
Arjan Molenaar
bc8b7041a9 macos: Add extra content type tests 2024-11-08 22:34:38 +00:00
Philip Withnall
dbb42933f8 Merge branch 'faccessat-bsd' into 'main'
glocalfile: Disable faccessat()-based query_exists on FreeBSD

See merge request GNOME/glib!4366
2024-11-06 13:13:01 +00:00
Sid
9e29968183 gtask: Fix comment for auto task naming via 'g_task_set_source_tag()' 2024-11-06 11:34:09 +00:00
Arjan Molenaar
6cb13b153c macos: Remove extraous space from type identifier 2024-11-04 16:31:36 +00:00
Emmanuele Bassi
7abfef8e06 Merge branch 'wip/pwithnall/fix-unix-mounts-tests-deprecations' into 'main'
tests: Fix calls to deprecated API in unix-mounts tests

See merge request GNOME/glib!4367
2024-11-04 16:27:12 +00:00
correctmost
5b2da7ecb3 gio: Fix GFileEnumerator leaks in gio tools 2024-11-03 12:22:01 -05:00
Gleb Popov
02172bda73 Enable GNetworkMonitorNetlink on FreeBSD 2024-10-29 21:18:36 +03:00
Philip Withnall
c14810e08f
tests: Fix calls to deprecated API in unix-mounts tests
This fixes commit aac56f1618 — I missed
this while reviewing it, but the unit tests were partially changed to
call the new APIs, without being fully changed. This caused the build to
succeed on Linux, but fail on macOS due to using a deprecated API.

Actually, a better approach for the unit tests would be to consistently
call the *old* APIs, as they all immediately call the new APIs. Then we
get coverage of both old and new for free, at the cost of putting
`G_GNUC_BEGIN_IGNORE_DEPRECATIONS` at the top of the test file.

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

Helps: #3492
2024-10-22 16:15:18 +01:00
Philip Withnall
e795c715b5 Merge branch 'fix-namespace-UnixMountEntry' into 'main'
UnixMountEntry: Deprecate g_unix_mount_* API in favor of g_unix_mount_entry_* API for GUnixMountEntry methods

Closes #3492

See merge request GNOME/glib!4337
2024-10-22 14:48:12 +00:00
Jialu Zhou
aac56f1618 UnixMountEntry: Deprecate g_unix_mount_* API in favor of g_unix_mount_entry_*
This issue arises because the g_unix_mount_* naming convention does not match
the GUnixMountEntry instance type, confusing the introspection generator.

To resolve this, we are deprecating the g_unix_mount_* API functions that take
a GUnixMountEntry parameter and introducing equivalent g_unix_mount_entry_*
functions that correctly associate with the GUnixMountEntry instance. This change
ensures that introspection data correctly treats these as instance methods and
that documentation reflects proper ownership of returned data.

(Some minor tweaks by Philip Withnall.)

Fixes: #3492
2024-10-22 15:31:52 +01:00
Philip Withnall
ad67d4e833
glocalfile: Disable faccessat()-based query_exists on FreeBSD
It appears not to work, and nobody interested in FreeBSD has picked it
up to investigate yet.

Rather than have a completely broken implementation of
`g_file_query_exists()` on FreeBSD, let’s settle for using the old one.
It’s slightly slower than the new one, but has worked fine for people
for years.

This essentially reverts commit 65ad41d8a4
on FreeBSD. This commit can be reverted when a FreeBSD person
investigates what’s going wrong with the `faccessat()`-based
implementation.

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

Helps: #3495
2024-10-22 13:37:55 +01:00
Michael Catanzaro
85b53d6317 Merge branch 'data-input-stream-optimisation' into 'main'
gdatainputstream: Use memchr() for the multi-stop-char case too

See merge request GNOME/glib!4352
2024-10-17 15:42:03 +00:00
Philip Withnall
50ccb04c71
tests: Fix 1-byte overread in data-input-stream tests
Commit 760a6f647 rearranged how the lengths are calculated for the test
data and added `escape_data_string()` so they could be printed safely.

Unfortunately there was a miscount in the length of the first test
vector in `test_read_upto()`: there are 31 bytes in the string literal,
plus one nul terminator which is added by the compiler. The quoted
string length was 32 bytes. This should be fine (explicitly including
the nul delimiter), but then `escape_data_string()` adds another byte to
the length because it assumes the nul delimiter has *not* been included
in the count.

Changing the string length from 32 to 31 breaks the tests, as the final
component of the data is then the wrong length, so add an additional
explicit nul byte to the string literal so that it matches the length.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-17 11:42:49 +01:00
Philip Withnall
e3e936f7ba
gdatainputstream: Use memchr() for the multi-stop-char case too
This is a follow up to commit e7e5ddd2a. oss-fuzz found a case where
performance was pathologically bad with a long `stop_chars` string.
Since our inner loop in that case was iterating over `stop_chars` and
comparing each of them to `buffer[i]`, we can use `memchr()` the
opposite way round to in commit e7e5ddd2a to speed that up, using
`buffer[i]` as the needle in a `stop_chars` haystack.

From some brief testing, this doesn’t impact on the performance of a
more normal use case of having a short (<10 bytes long) `stop_chars`. I
was slightly concerned that the function call overhead of calling out to
`memchr()` would have an impact there, but apparently not.

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

oss-fuzz#372994443
2024-10-17 11:42:43 +01:00
Philip Withnall
984224263d Merge branch 'hurd-socket-multicast-fix' into 'main'
gsocket: Fix #ifdef for defining g_socket_get_adapter_ipv4_addr()

See merge request GNOME/glib!4340
2024-10-15 19:00:06 +00:00
Alan Coopersmith
f46ea74586 build: verify #include <libelf.h> works before deciding to use it
This check is necessary for Solaris & illumos, where 32-bit libelf
is incompatible with large-file mode, which meson forces to be enabled,
but 64-bit libelf works fine.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-10-14 18:29:29 -07:00
Alan Coopersmith
b6004c70cc tests: add casts to avoid -Wformat errors on 32-bit Solaris builds
For historical reasons, pid_t & mode_t are defined as long instead
of int for 32-bit processes in the Solaris headers, and even though
they are the same size, gcc issues -Wformat headers if you try to
print them with "%d" and "%u" instead of "%ld" & "%lu".

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-10-14 18:29:29 -07:00
Philip Withnall
9f70c964a0
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:02:27 +01:00
Philip Withnall
066fefafa0
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 12:56:00 +01:00
Emmanuele Bassi
e286c295ef docs: Add Meson to the GSettings build integration
We've long since moved to Meson for GLib and most of GNOME, but our
documentation still only describes integration with Autotools. Let's
rectify this.
2024-10-11 10:17:32 +01:00
Michael Catanzaro
c70d98115b Merge branch 'signal-unsubscribe-cleanup' into 'main'
gio: Use g_steal_handle_id() with signal unsubscriptions

See merge request GNOME/glib!4341
2024-10-08 21:45:26 +00:00
Philip Withnall
7040162226 Merge branch 'fix-g_inet_address_new_from_string' into 'main'
simpleproxyresolver: Ignore host with scope id

See merge request GNOME/glib!4202
2024-10-08 13:48:32 +00:00
Gustav Johansson
a4a516a8ab simpleproxyresolver: Ignore host with scope id
Ignore host successfully when a ipv6 address contains a scope id.
2024-10-08 14:10:16 +01:00
Philip Withnall
0032ded759
gopenuriportal: Use g_steal_handle_id() for ownership transfers
This introduces no functional changes, but documents the intent a bit
better in the code where these signal IDs are stored in a struct.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-08 13:57:41 +01:00
Philip Withnall
6b15af3c4c
gio: Use g_steal_handle_id() with signal unsubscriptions
This makes no functional changes, but does tidy the code up a bit and
means `g_steal_handle_id()` gets a bit more testing.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-08 13:57:30 +01:00
Philip Withnall
0c84510c82
gsocket: Fix #ifdef for defining g_socket_get_adapter_ipv4_addr()
It was failing compilation on Hurd due to being defined but not used.

https://gitlab.gnome.org/GNOME/glib/-/jobs/4380104

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-10-08 13:13:08 +01:00
Nirbheek Chauhan
469084c45b 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 14:02:02 +00:00
Christian Hergert
760a6f6477 gio/tests: add test for single escape character
Converts the existing test to a loop and adds another test case which
tests a single stop character, \0 in this case.
2024-10-04 12:46:11 -07:00
Christian Hergert
e7e5ddd2ae gio/gdatainputstream: use memchr() when possible
Scanning for stop chars can require looking through a considerable amount
of input data. In the case there is a single stop character, use memchr()
which can be optimized by the compiler to look at word size or greater
amounts of data at a time.
2024-10-02 13:33:17 -07:00
Julian Sparber
c8e80132d8 tests: Add tests for launching default for file/uri via XDG portal 2024-10-01 19:03:37 +02:00
Julian Sparber
59877f5cc6 tests: Add launch context to g_app_info_launch_uris() tests
This ensure that `g_app_info_launch_uris()` uses and set the correct
activation token.
2024-10-01 18:25:52 +02:00
Julian Sparber
73970ee0b4 gopenuriportal: Improve error messages 2024-10-01 18:25:47 +02:00
Julian Sparber
0758788a25 gopenuriportal: Create GXdpOpenURI DBus proxy when needed
Instead of using singleton initialized the first time when it's needed
we can create the `DBusProxy` object when needed without blocking since
the interface doesn't have any properties nor signals.
2024-10-01 18:25:42 +02:00
Julian Sparber
89488e98e9 gopenuriportal: Use task data instead of object data
The docs recommend using a small number of `keys` when setting data for an
object, the OpenURI portal uses three different `keys` that can easily be replaced
with `g_task_set_task_data()`.
2024-10-01 18:25:37 +02:00
Julian Sparber
ef064d625b gopenuriportal: Fix two memory leaks 2024-10-01 18:25:31 +02:00
Philip Withnall
f6d7878a54 Merge branch 'speed-up-query-exists' into 'main'
gio: Add a query_exists vfunc to GFile

See merge request GNOME/glib!4272
2024-10-01 15:45:04 +00:00
Philip Withnall
2b5d3b5831 Merge branch 'fake-document-portal-in-process' into 'main'
tests: Move fake-document-portal subprocess inside dbus-appinfo test

See merge request GNOME/glib!4311
2024-10-01 15:38:30 +00:00
Matthias Clasen
ab51ed0521 gio: Implement query_exists for resources
This avoids allocations for this frequently used method.
2024-10-01 16:35:54 +01:00