Commit Graph

20113 Commits

Author SHA1 Message Date
Marek Cernocky
6575a9ab79 Updated Czech translation 2019-02-28 12:56:37 +01:00
Krzesimir Nowak
d687a45704 tests: Fix closure-refcount to preserve old semantics
The threads used to iterate at least 10000 times before setting the
"seen thread" flag to true. After porting they inadvertently did that
in the first iteration.
2019-02-28 07:05:29 +01:00
Changwoo Ryu
70cfc9d24c Update Korean translation 2019-02-28 03:15:07 +00:00
Tim Sabsch
acf32b13bb Update German translation 2019-02-27 18:22:53 +00:00
Philip Withnall
7536bacb3d Merge branch 'refcount-fixups' into 'master'
Move closures refcount test to gobject/tests/

See merge request GNOME/glib!696
2019-02-27 16:47:58 +00:00
Michael Catanzaro
8f1cbda085 Merge branch 'wip/tingping/threaded-resolver-unused-pool' into 'master'
gthreadedresolver: Remove unused thread pool

See merge request GNOME/glib!698
2019-02-27 15:53:51 +00:00
Patrick Griffis
5967b4501c gthreadedresolver: Remove unused thread pool 2019-02-27 10:41:32 -05:00
Philip Withnall
0d63ee0908 Merge branch 'wip/tingping/socket-client-slow-fix' into 'master'
gsocketclient: Fix critical on cancellation

Closes #1693 and #1653

See merge request GNOME/glib!688
2019-02-27 14:35:53 +00:00
Patrick Griffis
f0fcb68da5 tests: Unmark gsocketclient-slow as flaky
Closes #1653
2019-02-27 09:20:28 -05:00
Patrick Griffis
80af199d7d gsocketclient: Fix critical on cancellation
We need to be more explicit in handling cancellation to avoid
multiple task returns.

Fixes #1693
2019-02-27 09:20:28 -05:00
Philip Withnall
1ae54da69b tests: Continue closure-refcount test until all three threads are seen
Previously, the test assumed that thread1 and thread2 would be scheduled
enough to set seen_thread{1,2} by the fact that the test runs for a high
number of iterations. On some platforms/schedulers, that’s not true,
which causes the test to spuriously fail.

Fix that by forcing the test to continue iterating until both threads
are seen. If this takes too long, the Meson test runner timeout will be
hit and the test will be terminated.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
86f4a02b65 tests: Fix thread safety in closure-refcount test
Previously, all three threads would access several global variables
without locking.

Fix that by using atomic accesses to data stored within the
test_closure_refcount() function, which also eliminates the global state
(which would confuse further tests if they were added to this file).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
5a2a7f7db1 tests: Port closure-refcount from g_thread_create() to g_thread_new()
g_thread_create() has been deprecated for a long time.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
85c02df04e tests: Use g_assert_*() in closure-refcount, rather than g_assert()
g_assert() can be compiled out if G_DISABLE_ASSERT is defined; and
g_assert_*() provide more specific error messages on failure.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
d6e9111986 tests: Fix some code formatting in closure-refcount
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
Philip Withnall
31664e62f9 tests: Remove unnecessary static attributes from variables
These functions are not run more than once, so the variables don’t need
to be static to save state between runs.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-27 12:31:06 +00:00
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