Commit Graph

24793 Commits

Author SHA1 Message Date
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
Sebastian Dröge
4c8caadcfa Merge branch 'strv-contains' into 'main'
gdbusconnection: Use g_strv_contains() rather than a home-grown version

See merge request GNOME/glib!2556
2022-03-18 09:04:13 +00: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
411a20af2b Merge branch 'find_program_python3' into 'main'
meson: simplify lookup of python command

See merge request GNOME/glib!2541
2022-03-17 15:12:39 +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
Philip Withnall
8697c1a53c 2.72.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-17 15:01:31 +00:00
Charles Monzat
bc88032651 Update French translation 2022-03-17 10:57:34 +00:00
Milo Casagrande
41c9c09bc3 Update Italian translation 2022-03-17 08:34:54 +00:00
Мирослав Николић
612ab10958 Update Serbian translation 2022-03-17 06:58:23 +00:00
Simon McVittie
2fd4382821 Merge branch '2620-timezone-offset' into 'main'
gtimezone: Fix assertion failure when called with a huge offset

Closes #2620

See merge request GNOME/glib!2554
2022-03-16 16:23:35 +00:00
Philip Withnall
7ab9359af0 gtimezone: Fix assertion failure when called with a huge offset
This looks like a regression from commit 3356934db5, but prior to that
commit there was always an assertion failure when calling
`g_time_zone_new_offset()` with an offset which is too large (such as 44
hours), ever since the function was added in commit cf24867b93.

It would be ideal if we could return a `NULL` timezone to indicate the
error, but that’s not part of the API for `g_time_zone_new_offset()`, so
we have to go with the dated and not-ideal approach of returning the UTC
timezone and letting the caller figure it out.

Another potential approach would be to reduce the `offset` modulo 24
hours. This makes the error less easily detectable than if returning
UTC, though, and still returns an invalid result: `+44:00` is not the
same timezone as `+20:00` (it’s one day further ahead).

Add a unit test.

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

Fixes: #2620
2022-03-16 12:52:13 +00:00
Philip Withnall
7f0f87355b Merge branch 'mcatanzaro/typo' into 'main'
gtlsconnection: fix typo in docs

See merge request GNOME/glib!2552
2022-03-16 12:43:21 +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
b86750cb63 Merge branch 'wip/pwithnall/more-test-fixes' into 'main'
tests: More flaky test fixes to converter-stream and test-printf

See merge request GNOME/glib!2551
2022-03-16 10:32:44 +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
dbe34687d0 tests: Skip vasprintf() placeholder checks on FreeBSD and macOS
The `vasprintf()` version on those platforms seems to do less rigorous
checking of format placeholders.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/1890001 and
https://gitlab.gnome.org/GNOME/glib/-/jobs/1890000.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-14 17:59:37 +00:00
Philip Withnall
1094144b7a Merge branch 'gdbus-auth-test-timeout' into 'main'
tests: Various fixes to gdbus-auth, gdbus-non-socket, gdbus-connection-flush, spawn-multithreaded tests

See merge request GNOME/glib!2548
2022-03-14 12:52:43 +00:00
Simon McVittie
dbda5a4e38 Merge branch 'scheduled-ci-fixes' into 'main'
fuzzing: Fix test failure with G_DISABLE_ASSERT

See merge request GNOME/glib!2542
2022-03-14 12:25:32 +00:00
Baurzhan Muftakhidinov
8e89da90a3 Update Kazakh translation 2022-03-12 17:40:53 +00:00
Philip Withnall
c455d0efb7 tests: Correctly exit and join the worker threads in spawn-multithreaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
3f753b0fa3 tests: Fix the prototype of a GChildWatchFunc in spawn-multithreaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
ca99cf032d tests: Use separate GMainContext in thread in spawn-multithreaded
Otherwise the `start_thread()` threads and the main thread are competing
to iterate the global default context, which is probably not what was
intended.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
54748d3b7c tests: Lower thread TTLs in spawn-multithreaded
Otherwise the test takes forever, for no discernible benefit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
7b004d4052 tests: Fix a memory leak in spawn-multithreaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
8cb44235df tests: Remove sources when done in spawn-multithreaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
d6f99e5093 tests: Remove global variables from spawn-multithreaded
They make everything a lot harder to reason about, and easily allow for
state to leak between tests.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:46:07 +00:00
Philip Withnall
fd43391583 tests: Use g_assert_*() rather than g_assert() in spawn-multithreaded
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-12 01:12:19 +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
Philip Withnall
404d5d40e0 tests: Ensure timeout source is removed in gdbus-auth test
If the whole set of tests takes more than 5 seconds, the failure timeout
from the first test could still trigger, causing an incorrect failure.

Ensure the timeout is removed at the end of each test.i

This will hopefully fix the CI failure seen here:
https://gitlab.gnome.org/pwithnall/glib/-/jobs/1879558.
```
204/266 glib:gio / gdbus-auth                   FAIL     9.21 s (killed by signal 5 SIGTRAP)
…
ok 1 /gdbus/auth/client/EXTERNAL
Bail out! GLib-GIO-FATAL-ERROR: Timeout waiting for client
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-11 23:47:22 +00:00
Balázs Úr
91411338dc Update Hungarian translation 2022-03-10 19:44:52 +00:00
Sebastian Dröge
8bf6e498e6 Merge branch 'vasprintf-leak-fix' into 'main'
gprintf: Fix a memory leak with an invalid format in g_vasprintf()

See merge request GNOME/glib!2547
2022-03-10 08:09:04 +00:00
Philip Withnall
aa4385c1d9 gprintf: Clarify error behaviour of g_vasprintf() in docs
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-09 18:19:05 +00:00
Marek Černocký
c604cb1555 Fixech Czech translation 2022-03-09 19:09:26 +01:00
Loic Le Page
7a50259345 Fix redefinition of local variable in gio/glib-compile-schemas.c 2022-03-09 17:19:02 +01:00
Loic Le Page
9380a8cdb0 Fix redefinition of local variable in gio/glocalfilemonitor.c 2022-03-09 17:19:02 +01:00
Loic Le Page
d0dfc76554 Fix redefinition of local variable and non-initialized variable in gio/glocalfileoutputstream.c 2022-03-09 17:18:03 +01:00
Philip Withnall
bed82b807f tests: Re-enable address sanitizer for gdbus-test-codegen
Now that the leaks are fixed, this test can be run under the sanitizer
again.

This is a partial revert of commit
f378352051.

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

Helps: #2312
2022-03-09 14:21:22 +00:00
Philip Withnall
9499aeb8bf tests: Wait for signal unsubscriptions in gdbus-test-codegen
When destroying `GDBusProxy`s in a custom `GMainContext`, the context
must be iterated enough after finalisation of the proxies that any
pending D-Bus traffic, and the signal subscription data, can be freed.

See the documentation for `g_dbus_connection_signal_unsubscribe()`.

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

Fixes: #2312
2022-03-09 14:21:20 +00:00
Philip Withnall
d6ad10404f tests: Add some tests for g_string_append_vprintf()
This adds coverage of one previously uncovered branch in `gstring.c`.
Real progress!

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-09 14:09:57 +00:00
Philip Withnall
27e1509cd6 tests: Add some tests for g_vasprintf() invalid format strings
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-09 14:08:49 +00:00
Philip Withnall
7329c6e09b gprintf: Fix a memory leak with an invalid format in g_vasprintf()
If using the fallback implementation of `g_vasprintf()`.

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

Coverity CID: #1474726
2022-03-09 14:07:34 +00:00
Fabio Tomat
09a5ce5776 Update Friulian translation 2022-03-09 09:47:28 +00:00