Commit Graph

21407 Commits

Author SHA1 Message Date
Garrett Regier
6cac760551 task: Add return/propagate API for GValue
This is useful for bindings.

Related: https://gitlab.gnome.org/GNOME/glib/issues/668
2019-11-15 10:37:42 +00:00
Philip Withnall
fd3ed5e31b gatomic: Temporarily disable C11-style atomics on FreeBSD
They’re causing the CI to fail. While someone familiar with FreeBSD
investigates the failure, it’s easiest to disable all C11-style atomics
than add more preprocessor checks to only disable the atomics added in
!1123.

If nobody can fix the new C11-style atomics before the 2.64.0 release,
this commit should be reverted and a more comprehensive set of preprocessor
checks put in place to essentially revert !1123 for BSD only.

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

Helps: #1940
2019-11-15 10:28:21 +00:00
Philip Withnall
de2236584d tests: Tidy up test case naming in gdbus-serialization test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 10:12:59 +00:00
Philip Withnall
96d792197a gdbusmessage: Move variable initialisation to declaration time
Tidies up the code a bit, but introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 10:12:59 +00:00
Philip Withnall
e825a98845 Merge branch 'fix-utf8-pointer-test' into 'master'
gunicode: Fix an UB in gutf8.c and utf8-pointer test

Closes #1917

See merge request GNOME/glib!1199
2019-11-14 18:38:03 +00:00
nightuser
b555119ca3 gunicode: Fix UB in gutf8.c and utf8-pointer test
In glib/gutf8.c there was an UB in function g_utf8_find_prev_char when
p == str. In this case we substract one from p and now p points to a
location outside of the boundary of str. It's a UB by the standard.
Since this function are meant to be fast, we don't check the boundary
conditions.

Fix glib/tests/utf8-pointer test. It failed due to the UB described
above and aggressive optimisation when -O2 and LTO are enabled. Some
compilers (e.g. GCC with major version >= 8) create an optimised version
of g_utf8_find_prev_char with the first argument fixed and stored
somewhere else (with a different pointer). It can be solved with either
marking str as volatile or creating a copy of str in memory. We choose
the second approach since it's more explicit solution.

Add additional checks to glib/tests/utf8-pointer test.

Closes #1917
2019-11-14 18:38:03 +00:00
Sebastian Dröge
4dcad56fb2 Merge branch '1750-more-atomic-intrinsics' into 'master'
gatomic: Use new __atomic_*() intrinsics for all atomic operations

Closes #1750

See merge request GNOME/glib!1123
2019-11-14 13:40:47 +00:00
Michael Catanzaro
b75dd395ba gtlsconnection: clarify handshake() documentation
This tries to clarify some confusing aspects of the
g_tls_connection_handshake() that can trip up experienced developers.
2019-11-13 20:57:26 -06:00
Philip Withnall
c0e5c6c62c tests: Use g_assert_*() in param tests rather than g_assert()
It provides more useful output on failure, and isn’t compiled out when
building with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 19:45:03 +00:00
Philip Withnall
0815da8674 tests: Rework GParamSpec canonicalisation test
The documentation says that parameter names must be alphanumeric (plus
`-` or `_`) and that canonicalisation turns `_` into `-`.

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

Helps: #358
2019-11-12 19:45:03 +00:00
Philip Withnall
b080b456a6 gparam: Tidy up property naming documentation
There’s no need to have the property naming documentation in two places,
with one version of it being stricter than the other. Rationalise it to
one place, link to that consistently, and settle on the stricter
version.

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

Helps: #358
2019-11-12 19:45:03 +00:00
Philip Withnall
c4cedf60f8 glib.supp: Allow definite leaks of g_main_context_push_thread_default()
If a transient worker thread calls it, the allocated memory is
definitely leaked when the thread exits. That’s intentional.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 15:32:05 +00:00
Philip Withnall
b97c57b502 glib.supp: Allow definite leaks of g_private_set_alloc0()
If a transient worker thread calls it, the allocated memory is
definitely leaked when the thread exits. That’s intentional.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 15:05:58 +00:00
Philip Withnall
d8b45684ed Merge branch 'fix-macos' into 'master'
Add NOTE_REVOKE to the list of the monitoring events

See merge request GNOME/glib!1221
2019-11-11 17:59:31 +00:00
Alex Samorukov
1bb1bcd814 Add NOTE_REVOKE to the list of the monitoring events 2019-11-11 17:59:31 +00:00
Emmanuele Bassi
ecc5ffa4aa Merge branch 'th/fix-g-param-value-defaults-leak' into 'master'
gparam: fix memory leak in g_param_value_defaults()

See merge request GNOME/glib!1220
2019-11-11 17:56:05 +00:00
Thomas Haller
3a9bdcf704 gparam: fix memory leak in g_param_value_defaults()
We cannot  just call

    G_PARAM_SPEC_GET_CLASS (pspec)->value_set_default (pspec, &dflt_value);

without initializing the GValue first. It would call
param_string_set_default(), which would set the pointer value
to a cloned string (which later never gets released, because
the GValue is not known to hold a string).

Fixes: 6ad799ac67
2019-11-08 21:24:38 +01:00
Philip Withnall
b43bfcaa68 Merge branch 'use-gobject-hole' into 'master'
Use the GObject hole on 64bit arches for some flags to improve performance

See merge request GNOME/glib!1083
2019-11-07 08:15:03 +00:00
Philip Withnall
cc1b53f74e Merge branch 'fix-ghashtable-pretty-printer' into 'master'
gdb: Fix GHashTable pretty printer off-by-one error

See merge request GNOME/glib!1218
2019-11-06 12:24:04 +00:00
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