Commit Graph

7563 Commits

Author SHA1 Message Date
Philip Withnall
bd1781a356 build: Stop using Meson features deprecated in Meson <0.60
This clears some Meson warnings.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:55:28 +01:00
Xavier Claessens
374be41433 meson: Use meson.can_run_host_binaries()
It is not only shorter than `not meson.is_cross_build() or
meson.has_exe_wrapper()` but also handle the case of cross compiling to
a compatible arch such as building for i386 on an amd64.
2022-05-06 13:17:11 +01:00
Philip Withnall
25ab87d8e5 build: Drop checks and workarounds for older Meson versions
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Sebastian Dröge
0c6a1af9d6 Merge branch 'gdbus-threading-test-fix-maybe' into 'main'
tests: Reduce wakeup interval in gdbus-threading

See merge request GNOME/glib!2604
2022-04-29 08:05:52 +00:00
Sebastian Dröge
ef8e0035a5 Merge branch 'fix-gdbus-peer-object-manager-test' into 'main'
tests: Use G_TEST_OPTION_ISOLATE_DIRS in gdbus-peer-object-manager

See merge request GNOME/glib!2603
2022-04-29 08:04:33 +00:00
Sebastian Dröge
4f48d4e1bb Merge branch 'scan-build-fixes' into 'main'
Fix various scan-build warnings

See merge request GNOME/glib!2628
2022-04-28 11:07:34 +00:00
Sebastian Dröge
a0aff5404c Merge branch 'scan-build-leak-fix' into 'main'
gopenuriportal: Fix a use-after-free on an error path

See merge request GNOME/glib!2627
2022-04-28 10:44:57 +00:00
Philip Withnall
a17a27bcf1 glocalfileinfo: Remove a redundant store
This fixes a scan-build warning:
```
../../../../source/glib/gio/glocalfileinfo.c:1661:28: warning: Although the value stored to 'mydirname' is used in the enclosing expression, the value is never actually read from 'mydirname' [deadcode.DeadStores]
                           mydirname = g_strdup (dirname),
                           ^           ~~~~~~~~~~~~~~~~~~
```

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

Helps: #1767
2022-04-28 11:22:53 +01:00
Philip Withnall
969eb835dc gopenuriportal: Fix a use-after-free on an error path
`path` was used in building the error message after it had been freed.
Spotted by scan-build.

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

Helps: #1767
2022-04-28 11:22:33 +01:00
Philip Withnall
7f83151ac0 gsocket: Clear address before filling it
This will probably make no functional difference, but will squash two
warnings from scan-build:
```
../../../../source/glib/gio/gsocket.c:503:14: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
      family = address.storage.ss_family;
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../source/glib/gio/gsocket.c:527:29: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
       socket->priv->family = address.storage.ss_family;
                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
```

It seems like a reasonable thing to warn about. Initialising the full
union to zero should avoid any possibility of undefined behaviour like
that.

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

Helps: #1767
2022-04-28 10:50:08 +01:00
Philip Withnall
c02890645b tests: Drop redundant store
This fixes a scan-build warning:
```
../../../../source/glib/gio/tests/gdbus-tests.c:146:3: warning: Value stored to 'watch_id' is never read [deadcode.DeadStores]
  watch_id = 0;
  ^
```

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

Helps: #1767
2022-04-28 10:43:13 +01:00
Sebastian Dröge
0c1b7b263e Merge branch 'multicast-memcpy-size' into 'main'
gsocket: Add assertions about socket address sizes for memcpy()

See merge request GNOME/glib!2625
2022-04-27 14:32:16 +00:00
Philip Withnall
49cc9b96f4 gio-tool: Fix a minor memory leak when using gio-set with bytestrings
Tested using:
```sh
touch ~/foo
gio set ~/foo -t bytestring user::test "\x00\x00"
```
(it doesn’t matter that this fails; the bytestring is still decoded)

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

Coverity CID: #1474407
2022-04-27 15:01:08 +01:00
Philip Withnall
ff944776fe gsocket: Add assertions about socket address sizes for memcpy()
These `memcpy()` calls only happen if `g_inet_address_get_family(group)
== G_SOCKET_FAMILY_IPV4`, so the assertions should never fail.

It’s helpful for understanding the code, and for static analysis, to add
the assertions though.

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

Coverity CID: #1486858
2022-04-27 14:47:35 +01:00
Xavier Claessens
199ff2a841 Meson: Fix gio-windows-2.0 override name
The override name must match the pkgconfig name.
2022-04-24 21:29:26 -04:00
Marc-André Lureau
e9f46d3529 gio/tests: fix socket /socket/credentials/unix_socketpair on win32
When I enabled unix socketpair test on win32, I left the existing
g_close(fds[1]), but _g_win32_socketpair() returns native sockets
descriptors that must be closed with closesocket() on win32.

Let GSocket handle the socket pair cleanup.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Marc-André Lureau
89539d9ae0 gio/tests: GStatBuf.st_size is 64 bits on win64
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-04-14 15:38:47 +04:00
Philip Withnall
58f54e8303 tests: Reduce wakeup interval in gdbus-threading
When checking that the connection has the expected number of refs, the
test would block on a `GMainContext` iteration for up to 3s before
waking up and failing (if the refcount was still not as expected).

This check was written in the expectation that changing the refcount of
the connection would only happen due to dispatching a source on
`GMainContext` — hence the `GMainContext` would wake up as the refcount
changed.

That’s probably not actually true though. It might be the case that the
connection’s refcount is changed on from the GDBus worker thread, which
would not cause any wakeups on the main thread’s `GMainContext`.

In this case, the `GMainContext` iteration in
`assert_connection_has_one_ref()` would block for the full 3s, and then
wake up and notice the refcount is correct (then the test would
proceed).

That’s fine, apart from the fact that `test_threaded_singleton()` does
this 1000 times. If the slow case is hit on a significant number of
those test runs, the test will take around 3000s to complete, which is
significantly more than meson’s test timeout of 360s. So the test fails
with something like:
```
220/266 glib:gio+slow / gdbus-threading         TIMEOUT 360.07 s

--- command ---
G_TEST_SRCDIR='/builds/GNOME/glib/gio/tests' GIO_MODULE_DIR='' G_TEST_BUILDDIR='/builds/GNOME/glib/_build/gio/tests' /builds/GNOME/glib/_build/gio/tests/gdbus-threading
--- stdout ---
\# random seed: R02S83fe8de22db4d4f376e6d179e2bdd601
1..3
\# Start of gdbus tests
ok 1 /gdbus/delivery-in-thread
ok 2 /gdbus/method-calls-in-thread
\# GLib-GIO-DEBUG: refcount of 0x5602de913660 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913660 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913c60 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913c60 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913260 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
\# GLib-GIO-DEBUG: refcount of 0x5602de913260 is not right (3 rather than 1) in test_threaded_singleton(), sleeping
```

From this log, it can be seen that the sleep is happening on a different
`GMainContext` every other time, so the test *is* making progress.

Assuming this is a correct diagnosis (it’s a lot of guessing), this
commit tries to fix the test by adding a wakeup timeout to the
`GMainContext` in `assert_connection_has_one_ref()`, which will wake it
up every 50ms to re-check the exit condition.

This polling approach has been taken because it doesn’t seem feasible to
make sure that every `g_object_ref()`/`g_object_unref()` call on a
`GDBusConnection` causes the main context to wake up.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 14:39:43 +01:00
Philip Withnall
77416fc023 tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:29:19 +01:00
Philip Withnall
20c3ab9e51 tests: Use G_TEST_OPTION_ISOLATE_DIRS in gdbus-peer-object-manager
This might fix a recent test failure:
https://gitlab.gnome.org/GNOME/glib/-/jobs/1929015. Unfortunately
there’s not much debug information in the logs to go on, and I can’t
reproduce it locally. All I have is:
```
192/272 glib:gio / gdbus-peer-object-manager    FAIL     0.43 s (killed by signal 11 SIGSEGV)

--- command ---
GIO_MODULE_DIR='' G_TEST_BUILDDIR='/builds/GNOME/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/GNOME/glib/gio/tests' /builds/GNOME/glib/_build/gio/tests/gdbus-peer-object-manager
--- stdout ---
\# random seed: R02Seee9b7325ecd7c19249a3412397aed9b
1..2
\# Start of gdbus tests
\# Start of peer-object-manager tests
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-12 13:29:19 +01:00
Marc-André Lureau
2a925f273b gio/tests: DuplicateHandle() is inappropriate for SOCKET 2022-04-07 11:22:55 +00:00
Sebastian Dröge
86a24bb19a Merge branch 'wip/pwithnall/converter-stream-debugging' into 'main'
tests: Remove an incorrect assertion in converter-stream

See merge request GNOME/glib!2591
2022-04-06 13:15:01 +00:00
Jason Francis
a85246af3b gio: Add g_list_store_find_with_equal_func_full()
Fixes: #2447
2022-04-05 18:34:39 +01:00
Philip Withnall
aec5d17d77 tests: Remove an incorrect assertion in converter-stream
While the assertion always turned out to be true on Linux, it frequently
caused spurious test failures on FreeBSD.

After some remote debugging, I *think* the cause is as written up in the
comment in the code in this commit. However, I cannot be certain, as the
more debugging messages I added, the harder the failure was to
reproduce; and I don’t have access to a FreeBSD machine.

This fixes failures like:
```
Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1043:test_converter_pollable: assertion failed (error == NULL): Resource temporarily unavailable (g-io-error-quark, 27)
```

It’s succeeded 1000 times in a row on the FreeBSD CI now; previously
it was failing one time in three:
https://gitlab.gnome.org/GNOME/glib/-/jobs/1936395.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-05 18:19:23 +01:00
Philip Withnall
82ad0510d2 tests: Don’t exit gdbus-method-invocation test early on connection close
There’s (deliberately) a bit of race in implementing/handling
`CloseBeforeReturning()` in `gdbus-method-invocation.c`. If the server
closes the D-Bus connection early, the client may exit with `SIGTERM` if
`GDBusConnection:exit-on-close` is set. We don’t want that, as the test
is trying to check that the default handling of a D-Bus method return
after a connection has closed works.

See https://gnome.pages.gitlab.gnome.org/-/glib/-/jobs/1935191/artifacts/_build/meson-logs/testlog.txt

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-04-05 14:43:16 +01:00
Philip Withnall
bae0a3c751 Merge branch 'badcel/gunixfdlist-only-unix' into 'main'
GUnixFDList: Include only in unix build

See merge request GNOME/glib!2585
2022-04-05 12:12:19 +00:00
Philip Withnall
259c86909f Merge branch 'fix-trashing-sandboxed-directories' into 'main'
Fix trashing sandboxed directories

Closes #2629

See merge request GNOME/glib!2583
2022-04-05 11:58:33 +00:00
badcel
c9874f817b
GUnixFDList: Include only in unix build 2022-04-04 20:30:22 +02:00
Loic Le Page
c6a5021f48 Fix redefinition of local variable in gio/gdbusobjectmanagerclient.c 2022-04-04 17:39:59 +01:00
Loic Le Page
5223863922 Fix redefinition of local variable in gio/gdbusserver.c 2022-04-04 17:39:59 +01:00
Loic Le Page
af69d438ed Fix unused variable and remove finalize vfunc in gio/tests/gdbus-example-proxy-subclass.c
G_GNUC_UNUSED does perfectly its job with gcc compiler but the warning
still remains with msvc compiler.

Once the unused variable removed, the finalize vfunc can be removed as
it's doing the same job as the parent function.
2022-04-04 17:39:59 +01:00
Loic Le Page
4e3f704d49 Fix global variable name hidden by local variables in gio/tests/pollable.c 2022-04-04 17:39:58 +01:00
Loic Le Page
25ab7f1e74 Fix global variable name hidden by local variables in gio/tests/proxy.c 2022-04-04 17:39:42 +01:00
Loic Le Page
13710c3699 Fix global variable name hidden by local variables in gio/tests/resolver.c 2022-04-04 17:39:42 +01:00
Matthias Clasen
724df43616 Fix trashing sandboxed directories
We must not open the fd with O_PATH|O_NOFOLLOW,
since the portal rejects that combination. Leaving
out O_NOFOLLOW is fine in this case - we know it
is a directory, we just received EISDIR.

Fixes: #2629
2022-04-04 10:26:13 -04:00
Philip Withnall
6c31ef6f18 Merge branch 'cleanup-warnings-split-8' into 'main'
Cleanup warnings split 8

See merge request GNOME/glib!2497
2022-04-01 15:13:32 +00:00
Loic Le Page
e372ed3413 Fix cast pointer to int warning in gio/tests/socket.c 2022-04-01 15:10:50 +02:00
Loic Le Page
7bd79b112d Fix non-initialized variable in gio/tests/socket-client.c 2022-04-01 15:10:50 +02:00
Loic Le Page
027e3769ee Fix global variable name hidden by local variables in gio/tests/socket-server.c 2022-04-01 15:10:50 +02:00
Loic Le Page
7178e10cd5 Fix redefinition of local variable in gio/tests/testfilemonitor.c 2022-04-01 15:10:50 +02:00
Loic Le Page
c324ce5c2a Fix redefinition of local variable in gio/gactiongroupexporter.c 2022-04-01 15:10:50 +02:00
Loic Le Page
3214a0f333 Fix redefinition of local variable in gio/gapplicationimpl-dbus.c 2022-04-01 15:10:50 +02:00
Loic Le Page
0c1619227c Fix redefinition of local variable in gio/gdbus-tool.c 2022-04-01 15:10:50 +02:00
Loic Le Page
4bcb7bc631 Fix redefinition of local variable in gio/gdbusauth.c 2022-04-01 15:10:50 +02:00
Loic Le Page
eb157bfa1b Fix redefinition of local variable in gio/gdbusauthmechanismsha1.c 2022-04-01 15:10:41 +02:00
Loic Le Page
bf68e8606b Fix non-initialized variable and remove obsolete usage of inet_addr in gio/gsocket.c 2022-04-01 00:18:40 +01:00
Loic Le Page
7bde242707 Fix redefinition of local variable in gio/gsocks5proxy.c 2022-04-01 00:18:40 +01:00
Loic Le Page
bd5d867320 Fix global variable name hidden by local variables in gio/gthreadedresolver.c 2022-04-01 00:18:40 +01:00
Loic Le Page
49d0c5a90b Fix redefinition of local variable in gio/gtlscertificate.c 2022-04-01 00:18:40 +01:00
Loic Le Page
84dabcf274 Fix global and local variables hidden by local variables and non-initialized variables in gio/gwin32appinfo.c 2022-04-01 00:18:40 +01:00
Loic Le Page
155657de3e Fix redefinition of local variable in gio/gwin32file-sync-stream.c 2022-04-01 00:18:40 +01:00
Philip Withnall
f8302d29f1 Merge branch 'wip/smcv/simplify-openpty-linking' into 'main'
tests: Call openpty (if available) without using dlsym

See merge request GNOME/glib!2562
2022-03-31 15:09:46 +00:00
Loic Le Page
6888f9e17e Fix too small array definition in gio/gdummyfile.c (no room for the '\0') 2022-03-31 13:10:26 +01:00
Loic Le Page
5ec3a425d2 Fix non-initialized variable in gio/gfile.c 2022-03-31 13:10:25 +01:00
Loic Le Page
397ccd833b Fix global variable name hidden by local variables in gio/gfileinfo.c 2022-03-31 13:10:25 +01:00
Loic Le Page
cbdddf82c0 Fix global variable name hidden by local variables in gio/gio-tool-info.c 2022-03-31 13:10:25 +01:00
Loic Le Page
72cc5b3910 Fix global variable name hidden by local variables in gio/gio-tool-list.c 2022-03-31 13:10:25 +01:00
Loic Le Page
71de9553ca Fix global variable name hidden by local variables in gio/gio-tool-mount.c 2022-03-31 13:10:25 +01:00
Loic Le Page
c0dabdd8df Fix global variable name hidden by local variables in gio/gio-tool-save.c 2022-03-31 13:10:25 +01:00
Loic Le Page
781231d556 Fix global variable name hidden by local variables in gio/gio-tool-trash.c 2022-03-31 13:10:25 +01:00
Loic Le Page
a30ae2497d Fix redefinition of local variable in gio/giomodule.c 2022-03-31 13:10:25 +01:00
Loic Le Page
94264e6190 Fix redefinition of local variable in gio/giowin32-private.c 2022-03-31 13:10:25 +01:00
Sebastian Dröge
1fc402b33b Merge branch '2614-bye-bye-gamin' into 'main'
gio: Remove fam file monitor support

Closes #2614

See merge request GNOME/glib!2570
2022-03-23 16:45:04 +00:00
Philip Withnall
6aa210e6af gio: Remove fam file monitor support
libgamin was last released in 2007 and is dead
[upstream](https://gitlab.gnome.org/Archive/gamin). Distributions may
still ship it (although Fedora no longer does), but we want people to
use inotify on Linux since it’s actively supported.

BSDs use kqueue. Windows uses win32filemonitor.

FAM might still be used on some commercial Unix distributions, but there
are no contributors from those distributions, and certainly no CI for
them to prevent regressions.

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

Fixes: #2614
2022-03-23 15:41:54 +00:00
Philip Withnall
2759dd71be gio: Remove remaining references to fen file monitor
It used to exist on Solaris, but GLib’s support for it was mostly
removed in 2015 in commit 21ab660cf8.

Remove the final few references.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-23 15:40:41 +00:00
Marc-André Lureau
517bd62840 gio/win32: TIME_CREATED_USEC is u32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-23 19:34:32 +04:00
Philip Withnall
f9ef3bec68 gthreadedresolver: Only declare private test APIs on Unix
They’re only defined on Unix anyway. `GThreadedResolver` has an entirely
different code path for handling DNS replies on Windows.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:41:08 +00:00
Philip Withnall
e8e8aebcbe resolver: Add SRV support to manual resolver test
This allows for tests like:
```
resolver -t SRV _http._tcp.mxtoolbox.com
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
33204fe127 tests: Add tests for parsing specific DNS record types
Success and failure tests. This massively increases test coverage for
parsing DNS records, although it doesn’t get it to 100%.

It should now be useful enough to do more fuzzing on, without
immediately getting trivial failures from the fuzzer.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
0d42af06e0 gthreadedresolver: Treat query and answer counts as unsigned
They can’t be negative.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
08dee06b59 gthreadedresolver: Limit length of each record to its stated rdlength
Rather than limiting them to the full length of the answer, which may
include subsequent records.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
023fab80f9 gthreadedresolver: Add error checking to all record parsing
This should catch all kinds of invalid records, and correctly report
them as errors.

Heavily based on work by Patrick Griffis in !2134.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
81193c5aac gthreadedresolver: Don’t warn on unrecognised record types
Otherwise the code isn’t forwards-compatible, and may be DOSed by
servers returning unknown records, if `G_DEBUG=fatal-warnings` is
enabled for some reason.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
51f70fe62e tests: Add tests for invalid DNS response header parsing
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
2a7b4db243 gthreadedresolver: Expose g_resolver_record_type_to_rrtype()
So that it can be used in the tests.

It’s not part of the public, documented, supported API.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
8b73d7bbf9 gthreadedresolver: Handle error returns from dn_expand() in headers
It is possible for `dn_expand()` to fail; if so, it’ll return `-1`,
which will mess up subsequent parsing.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Philip Withnall
263ca69da8 gthreadedresolver: Check header length when parsing response
Otherwise we could read off the end of an invalid response.

oss-fuzz#42538
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-22 12:40:12 +00:00
Patrick Griffis
5cdacced3f tests: Add basic test framework for GResolver DNS parsing
Split out from https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2134
by Philip Withnall so it can be used in advance of HTTPS DNS record
support landing.

Reworked to no longer use test fixtures, as it’s simple enough to build
the response header in each test.

The tests are built on Unix only, as they test the parsing code in
`g_resolver_records_from_res_query()`, which is Unix-specific. The
Windows DNS APIs provide much more structured results which don’t need
parsing.
2022-03-22 12:40:12 +00:00
Philip Withnall
2e940e125f Merge branch 'w32-skips' into 'main'
Various win32 tests skip & fixes

See merge request GNOME/glib!2540
2022-03-21 12:19:24 +00:00
Simon McVittie
1726e150f4 tests: Call openpty (if available) without using dlsym
The SONAME of libutil varies between architectures, so the logic to find
the SONAME of libutil was only correct for native builds (Linux on
Linux), not for cross-builds. The regular expression was also not
sufficiently broad to match the SONAME used on the alpha architecture,
which is apparently libutil.so.1.1.

Instead of screen-scraping the output of ldconfig and using that to
dlopen the library that contains openpty, it seems more reliable to
emit a link-time reference to openpty and let the linker do its job.
It's also less code.

Bug-Debian: https://bugs.debian.org/1007946
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-19 14:10:51 +00:00
Philip Withnall
c53129911c Merge branch 'power-profile-monitor-docs' into 'main'
gpowerprofilemonitor: Tweak wording of documentation to make more sense

See merge request GNOME/glib!2534
2022-03-18 11:34:47 +00:00
Sebastian Dröge
73f918b376 Merge branch 'gdbus-method-invocation-leak' into 'main'
gdbusmethodinvocation: Fix a leak on an early return path

See merge request GNOME/glib!2557
2022-03-18 09:25:28 +00:00
Marc-André Lureau
e38e92e37b gio/tests/codegen: skip tests that require /dev/stdout on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:20:14 +04:00
Marc-André Lureau
b3d6946c27 tests/socket: skip a test if AF_UNIX is not supported on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e014b9272a gio/tests: skip filemonitor tests on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
cfc47558fc tests: enable defaultvalue and debugcontroller on win32
The test still requires dbus-daemon.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:38 +04:00
Marc-André Lureau
e9d9edde82 tests: skip appmonitor test on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-18 00:16:14 +04:00
Philip Withnall
a7750cd020 tests: Add unit tests for GDBusMethodInvocation
These should cover everything to do with returning a value or error from
a `GDBusMethodInvocation` object.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:17:41 +00:00
Philip Withnall
7143457076 gdbusmethodinvocation: Drop redundant quote from warning message
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
76f5460107 gdbusmethodinvocation: Fix dead code for type checking GetAll
`property_info` is only ever set for `Get` and `Set` calls, not for
`GetAll`, as it only represents a single property. So this code was
never reachable.

Move it out so that it is reachable.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 19:05:56 +00:00
Philip Withnall
a3b8846e54 gdbusmethodinvocation: Fix a leak on an early return path
When doing an early return from `g_dbus_method_invocation_return_*()`
due to passing in the wrong type (or no return value when one was
expected), the parameters were not correctly sunk and were leaked.

Fix that. A unit test will be added in a following commit.

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

Coverity CID: #1474536
2022-03-17 19:04:42 +00:00
Philip Withnall
4ef27174af tests: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:28:41 +00:00
Philip Withnall
e4d77f7e89 gdbusconnection: Use g_strv_contains() rather than a home-grown version
The public `g_strv_contains()` API didn’t exist at the time this code
was originally written. Now, happily, it does.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 16:24:08 +00:00
Philip Withnall
9b77b75f2d Merge branch 'w32-contenttype' into 'main'
Various contenttype-related test fixes on win32

See merge request GNOME/glib!2499
2022-03-17 15:14:14 +00:00
Philip Withnall
96279325b7 Merge branch 'cleanup-warnings-split-6' into 'main'
Cleanup warnings split 6

See merge request GNOME/glib!2495
2022-03-17 15:13:14 +00:00
Philip Withnall
1756dde873 Merge branch '2312-codegen-test-leak-fix' into 'main'
tests: Fix a leak in gdbus-test-codegen test

Closes #2312

See merge request GNOME/glib!2546
2022-03-17 15:12:08 +00:00
Michael Catanzaro
69a1867d51 gtlsconnection: fix typo in docs
Grrr, copy/paste error detected.
2022-03-16 10:38:34 +00:00
Philip Withnall
96caca2b7a tests: Explicitly close stream in converter-stream
When the test has finished writing all the expanded content into the
socket, explicitly close the output stream, which should make the input
stream readable and non-blocking.

The code intended to do this before, but only as a side-effect of
dropping its last reference to `right`. If another reference was being
held to `right` somewhere else, it wouldn’t end up being closed, which
would lead to failures like
https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000:
```
(/var/tmp/gitlab_runner/builds/Ff4WDDRj/0/GNOME/glib/_build/gio/tests/converter-stream:56570): GLib-GIO-DEBUG: 12:56:23.280: GSocketClient: Connection successful!
Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1042:test_converter_pollable: assertion failed (error == NULL): Resource temporarily unavailable (g-io-error-quark, 27)
stderr:
```

This is a bit of a guess (I’m not sure it’ll fix the intermittent test
error, as I haven’t been able to reproduce that locally), but it’s worth
a try.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-14 17:59:37 +00:00
Philip Withnall
8cff531520 tests: Isolate directory access for gdbus-connection-flush test
When multiple tests were run in parallel, this would race on its access
to `~/.dbus-keyrings` to authenticate with the D-Bus server, since the
keyring directory was not appropriately sandboxed to the unit test.

Use `G_TEST_OPTION_ISOLATE_DIRS` to automatically isolate each unit
test’s directory usage.

This should hopefully fix the failure seen in
https://gitlab.gnome.org/GNOME/glib/-/jobs/1849524, where the following
was in the log for a test executed in parallel:
```
GDBus-DBUS_COOKIE_SHA1: Deleted stale lock file '/home/user/.dbus-keyrings/org_gtk_gdbus_general.lock'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 00:03:05 +00:00
Philip Withnall
a3c768732d tests: Isolate directory access for gdbus-non-socket test
When multiple tests were run in parallel, this would race on its access
to `~/.dbus-keyrings` to authenticate with the D-Bus server, since the
keyring directory was not appropriately sandboxed to the unit test.

Use `G_TEST_OPTION_ISOLATE_DIRS` to automatically isolate each unit
test’s directory usage.

This should hopefully fix the failure seen in
https://gitlab.gnome.org/pwithnall/glib/-/jobs/1879558.
```
228/266 glib:gio / gdbus-non-socket             FAIL     8.64 s (killed by signal 6 SIGABRT)
…
--- stderr ---
GDBus-DBUS_COOKIE_SHA1: Deleted stale lock file '/home/user/.dbus-keyrings/org_gtk_gdbus_general.lock'
**
GLib-GIO:ERROR:../gio/tests/gdbus-non-socket.c:253:test_non_socket: assertion failed (error == NULL): Exhausted all available authentication mechanisms (tried: EXTERNAL, DBUS_COOKIE_SHA1) (available: EXTERNAL, DBUS_COOKIE_SHA1) (g-io-error-quark, 0)
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-11 23:56:18 +00:00