Commit Graph

21084 Commits

Author SHA1 Message Date
Philip Withnall
a4e12b62e9 Merge branch 'os-info-docs-formatting' into 'master'
gutils: Slightly improve docs formatting for g_get_os_info()

See merge request GNOME/glib!1208
2019-11-05 23:47:30 +00:00
Philip Withnall
0bbb8afcb1 gutils: Slightly improve docs formatting for g_get_os_info()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-05 23:03:38 +00:00
Philip Chimento
9042326ffc gdb: Fix GHashTable pretty printer off-by-one error
Commit 7678b107 seems to have left the GHashTable pretty printer with an
off-by-one error, skipping the first key it encounters and printing an
extra garbage key/value pair instead. This fixes that by moving an
increment to the end of a loop rather than the beginning.
2019-11-05 14:28:41 -08:00
Daniel Mustieles
e83c8abd2f Updated Spanish translation 2019-11-05 15:33:22 +01:00
Simon McVittie
37d4987b65 Merge branch '1777-sizet-checks' into 'master'
build: Check size_t compatibility with various other types

Closes #1777

See merge request GNOME/glib!1190
2019-11-05 12:31:12 +00:00
Simon McVittie
29772c30eb Merge branch '1930-bookmark-file-test-race' into 'master'
Fix race conditions in bookmarkfile test

Closes #1930

See merge request GNOME/glib!1217
2019-11-05 10:58:30 +00:00
Philip Withnall
422feb743d tests: Enable G_TEST_OPTIONS_ISOLATE_DIRS for bookmarkfile test
This ensures that when running many instances of the test in parallel,
they don’t collide in the same current directory, and hence spuriously
fail. This can happen when writing `out.xbel`, for example.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1930
2019-11-05 10:20:15 +00:00
Philip Withnall
a86c994255 tests: Switch some assertions around
In general, we should aim to always check a `GError` before checking a
boolean, since the error message from the `GError` gives us a lot more
information about failure, which helps with debugging.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-05 10:19:36 +00:00
Philip Withnall
a9900b774a tests: Fix race conditions in bookmarkfile tests
The time handling was assuming that the test would complete in the same
second as it started, which was not always true.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1930
2019-11-05 10:09:00 +00:00
Philip Withnall
4332e3b160 gbookmarkfile: Fix a minor leak on an error path
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-05 10:08:45 +00:00
Philip Withnall
3689fd9f8d tests: Use g_assert_*() instead of g_assert() in bookmarkfile test
`g_assert_*()` gives more useful messages on failure, and isn’t compiled
out by `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-05 09:51:47 +00:00
Philip Withnall
505c954424 build: Check size_t compatibility with various other types
When choosing the type to base `size_t` on, check the compatibility of
passing pointers, as well as the width of the type, to avoid compiler
warnings in future.

For now, the code to do the checks is fairly ugly due to limitations in
Meson. In particular, the new checks are limited to gcc and clang (other
compilers will behave as before), and they are all duplicated. See the
comments in the code for links to Meson improvement requests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1777
2019-11-05 09:20:00 +00:00
Garrett Regier
42369df7c6 task: Add scope annotation to run_in_thread{,_sync}()
Without specifying the scope, the two functions are non-introspectable
and GTask cannot be used meaningfully by bindings.

Related: https://gitlab.gnome.org/GNOME/glib/issues/668
2019-11-05 09:34:05 +01:00
Philip Withnall
963786f608 Merge branch 'wip/smcv/diagnose-bind-failure' into 'master'
gsocket: Improve diagnostics on bind() failure

See merge request GNOME/glib!1213
2019-11-04 16:59:16 +00:00
Philip Withnall
3b980ab9eb Merge branch 'wip/smcv/memcmp-null' into 'master'
gvariant, gbytes: Avoid memcmp (NULL, ., 0) or memcmp (., NULL, 0)

See merge request GNOME/glib!1214
2019-11-04 16:51:01 +00:00
Simon McVittie
e5675182f1 Merge branch 'ci-updates-for-1177' into 'master'
CI updates after !1177

See merge request GNOME/glib!1202
2019-11-04 16:43:25 +00:00
Philip Withnall
4d65f32703 Merge branch 'wip/smcv/cross-ld' into 'master'
Make ld executable configurable

See merge request GNOME/glib!1209
2019-11-04 16:26:24 +00:00
Philip Withnall
f371b2a9d3 Merge branch 'wip/smcv/gdbus-server-auth-test' into 'master'
gdbus-server-auth test: Include gcredentialsprivate.h

See merge request GNOME/glib!1210
2019-11-04 16:13:34 +00:00
Philip Withnall
1a53b73816 ci: Update .gitlab-ci.yml to use the latest Docker images
This is a follow-up to !1177, now that we’ve generated the new images.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-04 15:25:38 +00:00
Philip Withnall
8ae795ccba ci: Improve Docker building instructions slightly
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-04 15:25:38 +00:00
Simon McVittie
8235bbe467 gbytes: Avoid memcmp (NULL, ., 0) or memcmp (., NULL, 0)
Similar to 3837b83f, glibc memcmp is declared with the first two
arguments annotated as non-null via an attribute, which results in the
undefined behaviour sanitizer considering it to be UB to pass a null
pointer there (even if we are comparing 0 bytes, and hence not actually
dereferencing the pointer).

This shows up in /gvariant/serialiser/children when run with the
undefined behaviour sanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:10:24 +00:00
Simon McVittie
2465e64c93 gvariant: Avoid memcmp (NULL, ., 0) or memcmp (., NULL, 0)
Similar to 3837b83f, glibc memcmp is declared with the first two
arguments annotated as non-null via an attribute, which results in the
undefined behaviour sanitizer considering it to be UB to pass a null
pointer there (even if we are comparing 0 bytes, and hence not actually
dereferencing the pointer).

This shows up in /gvariant/serialiser/children when run with the
undefined behaviour sanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:10:24 +00:00
Simon McVittie
e08dffb71b gsocket: Improve diagnostics on bind() failure
This is in an attempt to diagnose GNOME/glib#1912.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:09:15 +00:00
Simon McVittie
81936ca580 Make ld executable configurable
Tools like this should be configurable in a cross or native file. In
particular, if we are cross-compiling (with an executable wrapper like
qemu-arm), the build system ld is not necessarily able to manipulate
host system objects.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:08:33 +00:00
Simon McVittie
49eccfbe70 gdbus-server-auth test: Include gcredentialsprivate.h
Otherwise we'll never test the EXTERNAL-only mode, because that relies
on testing the private macros
G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED and
G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED.

Fixes: 9f962ebe "Add a test for GDBusServer authentication"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:07:23 +00:00
Philip Withnall
6d8836515c Merge branch 'wip/smcv/gdbus-127001' into 'master'
gdbus-peer: Specifically listen on 127.0.0.1

Closes #1912

See merge request GNOME/glib!1212
2019-11-04 14:02:41 +00:00
Simon McVittie
7021b84f10 gdbus-peer: Specifically listen on 127.0.0.1
This bypasses any issues we might have with containers where IPv6 is
returned by name resolution (particularly since GNOME/glib!616) but
doesn't necessarily actually work.

This comes at a minor test-coverage cost: we don't test GDBusServer's
default behaviour when told to listen on "tcp:" or "nonce-tcp:", and
on systems where IPv6 is available, we don't test it. If we want to
do those, we should perhaps do them in separate tests, and disable
those tests when binding to ::1 doesn't work.

Mitigates: GNOME/glib#1912
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 13:31:14 +00:00
Philip Withnall
d97d4828d0 2.63.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-31 16:25:09 +00:00
Philip Withnall
ba29ef441b Merge branch 'wip/smcv/issue1923' into 'master'
goption: Relax assertion to avoid being broken by kdeinit5

Closes #1923

See merge request GNOME/glib!1206
2019-10-31 15:17:23 +00:00
Simon McVittie
00210aad87 goption: Relax assertion to avoid being broken by kdeinit5
kdeinit5 overwrites argv, which in turn results in /proc/self/cmdline
being overwritten. It seems that this is done in a way that does not
necessarily guarantee that /proc/self/cmdline will end up NUL-terminated.

However, g_file_get_contents() is documented to fill a buffer of size
len + 1, where buffer[len] == '\0', even if the file's actual contents
(from buffer[0] to buffer[len-1] inclusive) did not include a NUL;
so we can safely relax this assertion slightly.

Resolves: https://gitlab.gnome.org/GNOME/glib/issues/1923
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-31 13:54:51 +00:00
Philip Withnall
9b8ff414c1 Merge branch 'no-more-automatic-GUnixFDList' into 'master'
Revert "gdbus-codegen: emit GUnixFDLists if an arg has type 'h'"

See merge request GNOME/glib!1171
2019-10-31 13:42:55 +00:00
Philip Withnall
86bc43de51 Merge branch 'wip/mattiasb/gdbus-codegen-safer-headerguards' into 'master'
gdbus-codegen: Safer header guards

Closes #1379

See merge request GNOME/glib!1196
2019-10-31 13:29:18 +00:00
Mattias Bengtsson
4aaeac5b3c gdbus-codegen: Safer header guards
Whitelist a safe set of characters for use in header guards instead of
maintaining a (growing) blacklist.

The whitelist is intentionally short since reading up on all
peculiarities of the C and C++ standard for identifiers is not my idea
of fun. :)

Fixes #1379
2019-10-31 12:50:30 +00:00
Philip Withnall
623bdfd7ab Merge branch 'wip/smcv/gdbus-tests' into 'master'
Fix GDBus test failures on non-Linux (in particular FreeBSD)

Closes #1920 and #1921

See merge request GNOME/glib!1197
2019-10-31 12:38:12 +00:00
Philip Withnall
1503547766 Merge branch 'param-value-default' into 'master'
Allow using an empty GValue with g_param_value_set_default()

See merge request GNOME/glib!1186
2019-10-31 10:22:57 +00:00
Emmanuele Bassi
8b43be0f7a Merge branch 'live-file-static-analysis' into 'master'
Minor fixes from a scan-build run

See merge request GNOME/glib!1200
2019-10-30 16:23:23 +00:00
Philip Withnall
1111bc4cde gvariant-parser: Shut up a scan-build warning
Change a condition from one to an equivalent one to shut up a
`scan-build` warning about potentially dereferencing a `NULL` value.
This introduces no functional changes, as it’s not actually possible to
dereference a `NULL` value here (but `scan-build` can’t link the
nullability of `error` to the nullability of `result`).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:37:39 +00:00
Philip Withnall
15818926b3 glocalfileinfo: Fix minor leak on error handling path for xattrs
Spotted by `scan-build`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:35:15 +00:00
Philip Withnall
543a0c4091 tests: Fix unused variable in the threadpool-test
It looks like `continue_timeout` should be returned here, rather than
being set and never read. Spotted by `scan-build`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:24:08 +00:00
Philip Withnall
465b4dadf3 tests: Use g_assert_*() rather than g_assert() in live-g-file test
g_assert() is compiled out by `G_DISABLE_ASSERT` and doesn’t give such
useful messages on failure.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Philip Withnall
c25e8ec1f2 tests: Drop pointless assignments
Or turn them into proper error checks. This shuts up some `scan-build`
warnings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Philip Withnall
dd5132e041 tests: Tidy up GError assignment
No need to clear it to NULL before every time it’s used, since we assert
that it’s never set.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Simon McVittie
2b1e706b2f gdbus-server-auth test: Create temporary directory for Unix socket
This avoids failure to listen on the given address on non-Linux Unix
kernels, where abstract sockets do not exist and so unix:tmpdir is
equivalent to unix:dir.

To avoid bugs like this one recurring, run most of these tests using
the unix:dir address type, where Linux is equivalent to other Unix
kernels; just do one unix:tmpdir test, to check that we still
interoperate with libdbus when using abstract sockets on Linux.

Resolves: GNOME/glib#1920
Fixes: 9f962ebe "Add a test for GDBusServer authentication"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-29 16:36:19 +00:00
Simon McVittie
bab277fd50 gdbus-peer test: Use unix:dir address if exact format doesn't matter
Previously, we used unix:tmpdir, except in tests that verify that a
particular address type works (notably unix:dir). Now we use unix:dir
most of the time, and unix:tmpdir gets its own test instead.

This helps to ensure that the tests continue to work on non-Linux Unix
kernels, where abstract sockets do not exist and so unix:tmpdir is
equivalent to unix:dir, even in the common case where the developer has
only tried the test on Linux.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-29 16:35:46 +00:00
Simon McVittie
7c2e4095f4 gdbus-peer test: Stop GDBusServer before tearing down temporary directory
Otherwise, since GNOME/glib!1193, the listening socket won't be deleted,
and if we are not using abstract sockets (for example on *BSD), g_rmdir
will fail with ENOTEMPTY.

Fixes: 8e32b8e8 "gdbusserver: Delete socket and nonce file when stopping server"
Resolves: GNOME/glib#1921
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-29 16:35:06 +00:00
Simon McVittie
e1b7b1ac16 gdbus-peer test: Improve diagnostics if g_rmdir fails
Helps: GNOME/glib#1921
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-29 16:35:04 +00:00
Daniel Mustieles
0e1549eb20 Updated Spanish translation 2019-10-29 15:32:26 +01:00
Simon McVittie
4e8d058828 Merge branch '1912-gdbus-peer-test' into 'master'
tests: Isolate directories in gdbus-peer test

Closes #1912

See merge request GNOME/glib!1192
2019-10-29 08:37:22 +00:00
Simon McVittie
714f9f92b7 Merge branch '1318-dbus-server-race' into 'master'
gdbusserver: Keep a strong reference to the server in callbacks

Closes #1318

See merge request GNOME/glib!1193
2019-10-29 08:28:56 +00:00
Philip Withnall
0c07e672a2 gdbusserver: Keep a strong reference to the server in callbacks
The `on_run()` function could be executed in any worker thread from the
`GThreadedSocketListener`, but didn’t previously hold a strong reference
to the `GDBusServer`, which meant the server could be finalised in
another thread while `on_run()` was still running.

This was not ideal.

Hold a strong reference to the `GDBusServer` while the socket listener
is listening, i.e. between every paired call to `g_dbus_server_start()`
and `g_dbus_server_stop()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1318
2019-10-28 20:47:04 +00:00