Commit Graph

20350 Commits

Author SHA1 Message Date
Philip Withnall
3aec6a3976 tests: Minor GObject cleanup in closure-refcount
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
b4aadf6557 tests: Port closure-refcount to g_test_message() from g_print()
This allows more structured test output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 11:59:24 +00:00
Philip Withnall
15958c3ba9 tests: Port closure-refcount to use g_test_run()
This allows more structured test running and output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 11:59:23 +00:00
Philip Withnall
c96bfd57af build: Move tests/refcount/closures to gobject/tests/closure-refcount
One step towards removing the top-level tests/ directory.

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

Helps: #1434
2019-02-27 11:48:29 +00:00
Sebastian Dröge
cdcb6c2cf1 Merge branch '1698-base64-encoding' into 'master'
Resolve "g_base64_encode(NULL, 0) causes critical warnings"

Closes #1698

See merge request GNOME/glib!695
2019-02-27 11:42:04 +00:00
Philip Withnall
2484d1c950 gbase64: Remove an unnecessary condition
At that point in the code, len can only be 0, 1 or 2. The code below is
a no-op if (len == 0), so the condition is pointless.

Remove it, and we should be able to achieve full branch coverage of
gbase64.c.

This should introduce no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 11:21:43 +00:00
Philip Withnall
387e762879 tests: Add base64 tests from §(Test Vectors) of RFC 4648
While I’m here, we might as well check that we output what the RFC says
we should output.

https://tools.ietf.org/html/rfc4648#section-10

(We do.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 10:45:02 +00:00
Philip Withnall
f9dfddf8eb gbase64: Fix an impossible condition
len is unsigned, so it’s not possible for it to be less than zero.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 10:44:48 +00:00
Philip Withnall
ff76f6920e gbase64: Allow g_base64_encode (NULL, 0) and g_base64_decode ("", *)
Relax a precondition in g_base64_encode_step() to allow this. It’s valid
to base64 encode an empty string, as per RFC 4648.

Similarly for g_base64_decode(), although calling it with a NULL string
has never been allowed. Instead, clarify the case of calling it with an
empty string.

This includes a unit test.

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

Fixes: #1698
2019-02-27 10:44:14 +00:00
Philip Withnall
86e099c134 gbase64: Convert a precondition from g_error() to g_return_val_if_fail()
The caller needs to check this themselves in any case, so we might as
well at least follow convention in defining the precondition.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 10:13:18 +00:00
Tomasz Miąsko
153f63d13e gvariant-parser: Fix pattern coalesce of M and *
Previously pattern_coalesce incorrectly concluded that maybe type is not
present when one pattern starts with `M` and other pattern with anything
else than `M` or `m`. This is false when the other pattern is `*`, since
it includes the maybe type.
2019-02-26 17:27:49 +01:00
Philip Withnall
5c97cf666d Merge branch 'ossfuzz-11578-variant-text-type-detection' into 'master'
gvariant-parser: Fix error handling when type coalescing fails

See merge request GNOME/glib!639
2019-02-26 14:19:08 +00:00
Claude Paroz
d05466753f Update French translation 2019-02-25 14:41:35 +00:00
Tomasz Miąsko
c52021f340 tests: Don't leak check-proxies thread 2019-02-25 14:29:35 +01:00
Tomasz Miąsko
d75605e866 tests: Synchronize access to stopping flag 2019-02-25 14:29:35 +01:00
Philip Withnall
dc6b5f88c4 Merge branch 'update-gvdb' into 'master'
Update gvdb submodule

See merge request GNOME/glib!674
2019-02-25 13:04:08 +00:00
Philip Withnall
2b1bcbc99b Merge remote-tracking branch 'gvdb/master' into update-gvdb 2019-02-25 12:40:10 +00:00
Philip Withnall
25942f0176 Merge branch 'array-size' into 'master'
Fix size of preallocated array

See merge request GNOME/gvdb!3
2019-02-25 12:39:06 +00:00
Philip Withnall
7bf49c8df7 Fix size of preallocated array
Commit 084e1d868 added a preallocation to an array to avoid
reallocations later on, but neglected the fact that after N insertions
into the array, there’s always a NULL terminator added to the end. Fix
the preallocation to include that NULL terminator.

This doesn’t change the correctness of the code, but should eliminate
one reallocation.

Spotted by Sebastian Dröge. See
https://gitlab.gnome.org/GNOME/glib/merge_requests/674.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-25 12:38:08 +00:00
Emmanuele Bassi
78a2dd9632 Merge branch 'threaded-resolver-freebsd' into 'master'
gthreadedresolver: Fix initialisation on FreeBSD

Closes #1697

See merge request GNOME/glib!693
2019-02-25 11:47:56 +00:00
Philip Withnall
d7c93e3f86 Merge branch 'tsan-gtask' into 'master'
gtask: Separate GTask fields memory locations to avoid data races

See merge request GNOME/glib!691
2019-02-25 11:42:12 +00:00
Philip Withnall
6e7e5fff9a gthreadedresolver: Fix initialisation on FreeBSD
res_ninit() requires the __res_state struct passed to it to be
zero-filled on FreeBSD.

Spotted and analysed by Ashish SHUKLA.

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

Fixes #1697
2019-02-25 11:22:45 +00:00
Philip Withnall
04528e60b6 Merge branch 'valgrind-suppressions' into 'master'
glib.supp: Add more variations of existing suppressions

See merge request GNOME/glib!692
2019-02-25 11:09:57 +00:00
Philip Chimento
e06fe748d0 glib.supp: Add more variations of existing suppressions
There are some cases where valgrind turns up leaks that are already
suppressed in the file, but with a slight difference at the top of the
stack. Add suppressions for these cases as well.
2019-02-24 22:10:36 -08:00
Tomasz Miąsko
f975858e86 gcancellable: Synchronize access to cancelled flag
Synchronize access to cancelled flag of cancellable, which was
previously access without synchronization in g_cancellable_is_cancelled.
Use atomic operations instead of existing global mutex, to avoid
serializing calls to g_cancellable_is_cancelled across all threads.
2019-02-25 00:00:00 +00:00
Tomasz Miąsko
fef1ce37e4 gtask: Separate GTask fields memory locations to avoid data races
Ensure that fields that might be accessed in two different threads,
through conflicting actions are stored in seprate memory locations.
2019-02-22 22:22:07 +01:00
Tomasz Miąsko
6336864171 glocalfilemonitor: Fix data race in local file monitor
Ensure that source is attached to the context before it migth be used
from another thread, since otherwise operation on source are
unsynchronized and not thread-safe.

In particular there was a data race between g_source_attach and
g_source_set_ready_time (used from g_file_monitor_source_handle_event).
2019-02-22 18:09:32 +01:00
Tomasz Miąsko
c4cb27d844 gobject: Use atomic operations to read object reference count 2019-02-22 18:09:32 +01:00
Tomasz Miąsko
a3060bc84f gmain: Synchronize access to is_running flag of GMainLoop
Synchronize access to is_running field of GMainLoop to ensure that
g_main_loop_is_running is thread safe.
2019-02-22 18:08:34 +01:00
Tomasz Miąsko
fba7f7e097 gparam: Remove unsynchronized write to g_type field
GValue g_type field is used for synchronization with g_once_init_enter,
and so it should be written to only with g_once_init_leave.

Replace structure copy with memcpy that copies the one remaining field
of GValue, i.e., data array.
2019-02-22 17:53:18 +01:00
Tomasz Miąsko
d72192f69b gobject: Remove unsynchronized read of freeze_count
There is no need to preserve the check, since check is performed again
while holding the notify_locks that protects freeze_count.
2019-02-22 17:51:48 +01:00
Sebastian Dröge
5eb9f9f214 Merge branch 'glib-compile-resources-leak' into 'master'
glib-compile-resources: Fix a minor leak

See merge request GNOME/glib!689
2019-02-22 15:04:59 +00:00
Philip Withnall
7321f240f9 glib-compile-resources: Fix a minor leak
Spotted by oss-fuzz using asan.

oss-fuzz#13271

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-22 14:48:25 +00:00
Milo Casagrande
779448eb93 Update Italian translation 2019-02-22 11:08:24 +00:00
Michael Catanzaro
4d12174663 Merge branch '1679-socket-service-flaky' into 'master'
Resolve "socket-service test is flaky"

Closes #1679

See merge request GNOME/glib!687
2019-02-22 01:33:50 +00:00
Philip Withnall
86201989ea Merge branch 'code-owners' into 'master'
docs: Populate CODEOWNERS file

Closes #1668

See merge request GNOME/glib!684
2019-02-21 19:21:09 +00:00
Philip Withnall
f703bed5eb docs: Populate CODEOWNERS file
Rename it from CODE-OWNERS and make it follow the documented syntax
supported by GitLab:
https://docs.gitlab.com/ee/user/project/code_owners.html. Currently our
version of GitLab doesn’t support it, but it may do in future.

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

https://gitlab.gnome.org/GNOME/glib/issues/1668
2019-02-21 18:53:47 +00:00
Philip Withnall
07414e17ef tests: Unmark socket-service test as flaky
This essentially reverts commit
cffed58737.

The preceding two commits have fixed the test so it’s no longer flaky.
The following command gives 5000 passes in a row for me:

meson test -C /opt/gnome/build/glib/ socket-service --repeat 5000

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

Fixes: #1679
2019-02-21 18:15:49 +00:00
Philip Withnall
f25c3f2704 tests: Fix unlikely race in socket-service test
It’s occasionally possible for the cancellation of the service to happen
before connection_cb() gets scheduled in the other thread. The
locking/unlocking order of mutex_712570 requires:
 • test_threaded_712570(): lock mutex
 • test_threaded_712570(): start wait loop
 • connection_cb(): lock mutex
 • test_threaded_socket_service_finalize(): unlock mutex
 • test_threaded_712570(): end wait loop
 • test_threaded_712570(): unlock mutex

Fix that by quitting the main loop once connection_cb() has been called
(i.e. once the server thread has received the incoming connection
request), rather than just after the client thread (main thread) has
sent a connection request.

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

Helps: #1679
2019-02-21 18:15:49 +00:00
Philip Withnall
2aea9c84c0 tests: Fix flaky socket-service test caused by GTask scheduling
On about 1 in 3 test runs, the socket-service would fail with the
ref_count assertion in connection_cb() failing (the ref_count would be 3
rather than the expected 2).

This was happening because the GTask from
g_socket_listener_accept_socket_async() now always takes at least one
main context iteration to return a result (whereas before
6f3d57d2ee it might have taken zero), but
the ref_count can drop below 3 before the process of returning a result
starts. During the process of returning a result, the ref_count
temporarily increases again, which is what was breaking the test.

Fix this by waiting for one more main context iteration. This is a bit
of a hack, but the real fix would be to expose the outstanding_accept
boolean from GSocketService as public API (which the test can
interrogate), and that seems too much like exposing internal state.

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

Helps: #1679
2019-02-21 18:14:56 +00:00
Jordi Mas
b1033dd3e9 Update Catalan translation 2019-02-21 17:39:21 +01:00
Sebastian Dröge
ffe5cdab5c Merge branch 'fix-gio-modules-msvc' into 'master'
gio: Also support modules built with MSVC

See merge request GNOME/glib!686
2019-02-20 21:14:46 +00:00
Nirbheek Chauhan
2d6c4b289a meson: Add gobjectenumtypes.h to gioenumtypes_dep
Almost everything that needs gioenumtypes.h also needs
gobjectenumtypes.h. Fixes:

ccache cc @gio/win32/gio@win32@@giowin32@sta/gwin32filemonitor.c.obj.rsp
In file included from ../gio/win32/gwin32filemonitor.h:25:0,
                 from ../gio/win32/gwin32filemonitor.c:26:
../glib/glib-object.h:37:10: fatal error: gobject/gobjectenumtypes.h: No such file or directory
 #include <gobject/gobjectenumtypes.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-02-20 22:37:56 +05:30
Nirbheek Chauhan
8e3fc7dfaa gio: Also support modules built with MSVC
GIO modules built with MSVC do not begin with 'lib', but they can
begin with 'gio'. Without this, you can only load GIO modules built
with MSVC that are `name.dll`, not `gioname.dll`.
2019-02-20 21:26:36 +05:30
Philip Withnall
9aab30641e Merge branch 'fix_cname' into 'master'
glib-compile-resources: Fixes #1675

Closes #1675

See merge request GNOME/glib!633
2019-02-20 10:38:29 +00:00
Felix Potthast
45655b8265 glib-compile-resources: Fixes #1675 2019-02-20 10:38:29 +00:00
Philip Withnall
111f2b79e7 glib-compile-schemas: Fix capitalisation of a command line option help
The other descriptions of command line options start with a capital.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-18 17:21:13 +00:00
Philip Withnall
fd3219aaa1 glib-compile-schemas: Improve translatable strings
Eliminate several cases of splitting sentences between multiple
translatable strings, and remove some newlines from the translatable
strings (they always need to be present, and can confuse translation, so
add them unconditionally afterwards).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-18 17:15:15 +00:00
Sebastian Dröge
aa6aa8b5e4 Merge branch 'gerror-docs-omission' into 'master'
gerror: Add a missing precondition assertion in documentation

See merge request GNOME/glib!677
2019-02-18 14:13:33 +00:00
Philip Withnall
321f914071 gerror: Add a missing precondition assertion in documentation
Inspired by !673.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-18 13:23:13 +00:00