Commit Graph

7381 Commits

Author SHA1 Message Date
Philip Withnall
3bef2760e9 Merge branch 'docs' into 'main'
docs: mark macros, flags, enums with percent sign

Closes #2589

See merge request GNOME/glib!2470
2022-03-04 16:21:55 +00:00
Gabor Karsay
7e64004db0 docs: mark macros, flags, enums with percent sign 2022-03-04 16:21:55 +00:00
Philip Withnall
f08324e014 Merge branch 'w32-tests-spawn' into 'main'
Various spawn-related test fixes on win32

See merge request GNOME/glib!2485
2022-03-04 16:16:39 +00:00
Sebastian Dröge
420238e0c4 Merge branch 'debug-controller-unused' into 'main'
gdebugcontrollerdbus: Mark a variable as G_GNUC_UNUSED

See merge request GNOME/glib!2519
2022-03-03 14:54:28 +00:00
Sebastian Dröge
8091727b27 Merge branch 'wip/pwithnall/macos-tests' into 'main'
tests: Stop ignoring test failures on macOS

See merge request GNOME/glib!2505
2022-03-03 14:53:38 +00:00
Philip Withnall
c1293acb27 gtask: Document that task name is set by g_task_set_source_tag()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-03 12:42:28 +00:00
Xavier Claessens
218ac195df meson: Add schemasdir and giomoduledir to gio dependency
This allows applications to get their value regardless whether glib is a
subproject or pkgconfig:

  gio_dep = dependency('gio-2.0')
  giomoduledir = gio_dep.get_variable('giomoduledir')
  schemasdir = gio_dep.get_variable('schemasdir')
2022-02-23 08:24:00 -05:00
Philip Withnall
dbd11f3d3b Merge branch 'wip/pwithnall/revert-2517' into 'main'
Revert "meson: Add schemasdir and giomoduledir to gio dependency"

See merge request GNOME/glib!2524
2022-02-23 12:17:29 +00:00
Philip Withnall
7f8c09cd07 Merge branch 'wip/pwithnall/network-address-test-fixes' into 'main'
tests: Remove threads from mock-resolver/network-address test

See merge request GNOME/glib!2520
2022-02-23 12:03:28 +00:00
Philip Withnall
590a2c9af8 Revert "meson: Add schemasdir and giomoduledir to gio dependency"
This reverts commit 5aa03882ca.

It fails to compile on newer Meson versions with
`--fatal-meson-warnings` due to:
```
WARNING: Project targeting '>= 0.52.0' but tried to use feature introduced in '0.54.0': variables arg in declare_dependency.
gio/meson.build:833:0: ERROR: Fatal warnings enabled, aborting
```

That happens regardless of the fact that we’ve correctly limited the use
of the `variables` argument to only when building with Meson ≥ 0.56.
Unfortunately Meson can’t statically detect that the argument is
conditional.

Bumping GLib’s Meson dependency is too much work right now, so this MR
unfortunately has to be reverted.
2022-02-23 11:51:13 +00:00
Marc-André Lureau
0f85eefb8b gio: fix OOB string access if filename is empty
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-22 23:55:57 +04:00
Philip Withnall
68dc5d5fbc Merge branch 'meson-gio-var' into 'main'
meson: Add schemasdir and giomoduledir to gio dependency

See merge request GNOME/glib!2517
2022-02-22 18:22:52 +00:00
Xavier Claessens
5aa03882ca meson: Add schemasdir and giomoduledir to gio dependency
This allows applications to get their value regardless whether glib is a
subproject or pkgconfig:

  gio_dep = dependency('gio-2.0')
  giomoduledir = gio_dep.get_variable('giomoduledir')
  schemasdir = gio_dep.get_variable('schemasdir')
2022-02-22 08:54:07 -05:00
Philip Withnall
00faa84f77 Merge branch 'giomodule' into 'main'
meson: Set GIO_EXTRA_MODULES in devenv

See merge request GNOME/glib!2518
2022-02-22 13:38:58 +00:00
Philip Withnall
13c4b9579b tests: Remove threads from mock-resolver/network-address test
`mock-resolver.c` is a mock implementation of `GResolver` used in the
`network-address` tests. It returns resolver results, and implements
timeouts, as directed by the test calling it.

In particular, it allows the IPv4 and IPv6 resolver results to be
returned using independent delays. This allows code paths which deal
with IPv4 and IPv6 results being returned at different times to be
tested, as the ‘Happy Eyeballs’ spec mandates various hard-coded
timeouts for returning the best results it can in a reasonable
timeframe.

Previously, `mock-resolver.c` implemented the timeouts by handling
`lookup_by_name()` in a `GTask` worker thread, and calling `g_usleep()`
for the timeout. This seemed to cause occasional CI failures, such as
https://gitlab.gnome.org/GNOME/glib/-/jobs/1843454, where a resolver
error would be returned rather than the expected results:
```
ok 52 /network-address/happy-eyeballs/ipv4-error-ipv6-first
\# GLib-GIO-DEBUG: IPv4 DNS error: IPv4 Broken
(/var/tmp/gitlab_runner/builds/Ff4WDDRj/0/GNOME/glib/_build/gio/tests/network-address:18428): GLib-GIO-DEBUG: 09:03:08.587: IPv4 DNS error: IPv4 Broken
Bail out! GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24)
stderr:
**
GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24)
```

While I’ve been unable to reproduce these failures locally, I suspect
they might be down to thread spawning occasionally taking long enough on
a CI runner to change the ordering of the timeouts, such that the ‘Happy
Eyeballs’ algorithm returns a different set of results from what the
test expects.

So, this commit rewrites part of `mock-resolver.c` to implement timeouts
in the main thread, rather than in a worker thread. That should
eliminate the delays in spawning threads, and should mean that the
timeout sources in `mock-resolver.c` are attached to the same
`GMainContext` as those from the ‘Happy Eyeballs’ algorithm which are
monitoring them, so a total order over the timeouts can be guaranteed.

Of course, I might be completely wrong since this is just a guess and I
can’t properly test it since I can’t reproduce the failure. Worth a try.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
bb2d79e6a8 tests: Use g_assert_*() rather than g_assert() in network-address.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
a57706887e tests: Fix memory leaks in network-address test
The test results weren’t being freed.

This makes the `network-address` test clean under memcheck for me.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 11:25:21 +00:00
Philip Withnall
cd9ed612a7 gdebugcontrollerdbus: Mark a variable as G_GNUC_UNUSED
It’s not used when compiling with `G_DISABLE_ASSERT`. This fixes the CI
build failure here: https://gitlab.gnome.org/GNOME/glib/-/jobs/1843082
```
[461/1229] Compiling C object 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o'.
FAILED: gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o
cc -Igio/6ae6c9e@@gio-2.0@sha -Igio -I../gio -I. -I../ -Iglib -I../glib -Igobject -I../gobject -Igmodule -I../gmodule -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=gnu99 -g -D_GNU_SOURCE -fno-strict-aliasing -DG_ENABLE_DEBUG -DG_DISABLE_ASSERT -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-prototypes -fPIC '-DG_LOG_DOMAIN="GLib-GIO"' -DGIO_COMPILATION '-DGIO_MODULE_DIR="/usr/local/lib64/gio/modules"' '-DLOCALSTATEDIR="/usr/local/var"' -fvisibility=hidden -MD -MQ 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o' -MF 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o.d' -o 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o' -c ../gio/gdebugcontrollerdbus.c
../gio/gdebugcontrollerdbus.c: In function ‘authorize_cb’:
../gio/gdebugcontrollerdbus.c:345:32: error: unused variable ‘priv’ [-Werror=unused-variable]
  345 |   GDebugControllerDBusPrivate *priv = g_debug_controller_dbus_get_instance_private (self);
      |                                ^~~~
cc1: all warnings being treated as errors
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-22 09:35:40 +00:00
Xavier Claessens
0071abc187 meson: Set GIO_EXTRA_MODULES in devenv
This makes GIO find the fam module within "meson devenv" without having
to install it on the system.
2022-02-21 13:22:54 -05:00
Simon McVittie
6517bbfbc3 glocalfileinfo: Always define _g_stat_mtim_nsec, etc.
If these struct members aren't available, we can be more like an
abstraction layer by falling back to yielding 0.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-21 16:58:08 +00:00
Simon McVittie
3c12ddce81 Merge branch '1929-dbus-auth-locking' into 'main'
gdbusauthmechanismsha1: Don’t delete a stale lock file if it’s changed

Closes #1929

See merge request GNOME/glib!2511
2022-02-21 13:48:54 +00:00
Philip Withnall
36112f9b83 tests: Stop ignoring test failures on macOS
Test failures were previously ignored on macOS because there are 12
tests which consistently fail (and have not yet been fixed, because
there are no regularly active macOS maintainers for GLib; you could help
here!).

However, this means that new test failures can’t be spotted.

So, explicitly mark those 12 tests as `should_fail` on macOS, and then
make other test failures cause failure of the CI run.

We can track the process of fixing those 12 tests on #1392 and #1251.

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

Helps: #1392
2022-02-20 15:01:59 +00:00
Philip Withnall
5180c7de1e tests: Make debugcontroller and defaultvalue depend on dbus-daemon
As they use `g_test_dbus_*()`, they depend on dbus-daemon, so move them
to the part of the Meson file which lists those tests.

This disables them running on platforms which don’t have `dbus-daemon`
available. Arguably, this should be done by returning an error from
`g_test_dbus_up()` and then calling `g_test_skip()`, so the test is
correctly recorded as having been skipped. But that’s a fix for another
time.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 15:01:38 +00:00
Philip Withnall
ae903744ee Merge branch 'environment-test-fixes' into 'main'
tests: Fix various small memory leaks

See merge request GNOME/glib!2509
2022-02-20 12:09:00 +00:00
Philip Withnall
c60a0a45de tests: Fix a memory leak in the tls-certificate test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
a4ce8399cd tests: Fix memory leaks in the g-file-info-filesystem-readonly test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
d007fdb079 tests: Fix a memory leak in the resources test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
9434e4a40c tests: Use g_assert_*() rather than g_assert() in resources.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-20 10:43:26 +00:00
Philip Withnall
cb18e6b969 Merge branch 'empty-argv' into 'main'
Various minor fixes for empty argv handling

See merge request GNOME/glib!2466
2022-02-20 09:36:41 +00:00
Philip Withnall
01a432d6ff glocalfileinfo: Add missing _g_stat_*() methods for win32
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 13:50:19 +00:00
Philip Withnall
648f9efce0 tests: Remove extra debugging from gdbus-connection-flush
Having compared the debug output, it doesn’t show anything unusual
happening that can’t already be seen from other output, for this test.

This is a partial revert of 8fd71dccc5. The debugging output it added to
other tests may still be useful.

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

Helps: #1929
2022-02-18 13:24:13 +00:00
Philip Withnall
693e4efeba tests: Use g_assert_*() rather than g_assert() in gdbus-connection-flush.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 13:22:16 +00:00
Philip Withnall
dc0eb5e49a gdbusauthmechanismsha1: Don’t delete a stale lock file if it’s changed
The retry loop for acquiring the lock for the authentication cookie file
currently tries to acquire the lock for 0.5s, then gives up, assumes the
lock file is stale, and deletes it.

That’s great if the lock file *is* stale because it’s been left there by
a crashed process.

It’s not so great if the lock file just happens to have been there every
time this process checked, because the cookie file is highly contested
while (for example) running lots of parallel unit tests.

Check for that situation by comparing the mtime of the lock file and
continuing to retry if it’s changed.

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

Fixes: #1929
2022-02-18 13:17:19 +00:00
Philip Withnall
10e5c21102 Merge branch 'desktop-app-info-leak' into 'main'
gdesktopappinfo: Fix a leak when launching URIs over D-Bus

See merge request GNOME/glib!2510
2022-02-18 12:06:13 +00:00
Philip Withnall
3583526c2d Merge branch 'disable-assert-fix' into 'main'
gresource-tool: Fix unused-but-set-variable warn with G_DISABLE_ASSERT

See merge request GNOME/glib!2506
2022-02-18 10:38:44 +00:00
Philip Withnall
5046dd8679 Merge branch 'fix-style-check' into 'main'
codegen: Reformat parser.py according to black

See merge request GNOME/glib!2508
2022-02-18 10:38:05 +00:00
Philip Withnall
f6aafcd028 gdesktopappinfo: Fix a leak when launching URIs over D-Bus
If any platform data is set, the temporary `GVariantDict` was being
leaked.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 10:35:10 +00:00
Philip Withnall
d551e81812 Merge branch 'fix-compile-resources-leak' into 'main'
glib-compile-resources: Fix a memory leak of the compiler option

See merge request GNOME/glib!2501
2022-02-18 10:34:25 +00:00
Philip Withnall
f300e883e7 codegen: Reformat parser.py according to black
This fixes the `style-check-diff` CI job.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 01:45:10 +00:00
Philip Withnall
425702df9c gresource-tool: Fix unused-but-set-variable warn with G_DISABLE_ASSERT
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 01:40:44 +00:00
Philip Withnall
9652a3dd79 gdebugcontrollerdbus: Track pending tasks with weak refs
Rather than tracking them with a counter. This should close the race in
tracking the finalisation of the tasks by the task worker thread.
There’s no way to synchronise with that thread as it’s internal to
`g_task_run_in_thread()`.

This should hopefully stop the `debugcontroller` test being flaky.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2486#note_1384102

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-18 00:46:07 +00:00
Philip Withnall
a09aca68d4 glib-compile-resources: Fix a memory leak of the compiler option
`G_OPTION_ARG_STRING` returns a newly allocated string, not a `const`
one.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-17 21:18:27 +00:00
rim
37b39c525f Add cache to g_unix_mount_points_get() 2022-02-16 10:53:40 +00:00
Philip Withnall
c39c2a2821 Merge branch 'ebassi/issue-2601' into 'main'
Fix the DocBook codegen

Closes #2601

See merge request GNOME/glib!2489
2022-02-15 14:07:02 +00:00
Philip Withnall
b5873878cd Merge branch '1190-debugging-docs' into 'main'
gdebugcontroller: Add documentation and tests

Closes #1190

See merge request GNOME/glib!2486
2022-02-15 12:47:50 +00:00
Emmanuele Bassi
47ce6432f3 codegen: Verify that we're generating valid XML
We should output valid XML even when getting an iffy annotation.
2022-02-15 12:14:49 +00:00
Emmanuele Bassi
17f38affa2 codegen: Add missing closing angular bracket
We are matching `<parameter>` as well as `<para>`, and we
end up with broken XML in case the (expanded) description
starts with `<parameter>`.

Fixes: #2601
2022-02-15 11:51:11 +00:00
Emmanuele Bassi
6ddf760507 codegen: Remove flake8 lint rule
Using `flake8: noqa` disables ALL linting on a file. Adding
an error code does not limit the linter to that error.
2022-02-15 11:48:58 +00:00
Emmanuele Bassi
128ae2b5f5 codegen: Fix whitespace
This is Python, not C.
2022-02-15 11:48:28 +00:00
Emmanuele Bassi
fe3f699371 Add .flake8 file
The flake8 validation tool prefers an actual configuration
file to inline comments to disable the lint.
2022-02-15 11:47:30 +00:00