Commit Graph

19369 Commits

Author SHA1 Message Date
Matthias Clasen
d3f5559780 Merge branch '1575-revert-strftime-format' into 'master'
Revert "gdatetime: Enable compile time check of g_date_time_format() format"

Closes #1575

See merge request GNOME/glib!442
2018-11-01 18:12:41 +00:00
Dušan Kazik
e1056e5979 Update Slovak translation
(cherry picked from commit 985210849c)
2018-11-01 18:05:52 +00:00
Philip Withnall
664fb6303b Revert "gdatetime: Enable compile time check of g_date_time_format() format"
This reverts commits:
 • 9ddcc79502ae02adc3c3

g_date_time_format() supports a few non-standard format placeholders:
 • %:z
 • %::z
 • %:::z

These are all gnulib strtime() extensions, and hence are not recognised
by the compiler when the function is annotated with G_GNUC_STRFTIME.
However, this wasn’t noticed when we originally merged this change
because the errors were disabled in the tests which covered those
placeholders.
2018-11-01 16:12:32 +00:00
Matthias Clasen
9ddcc79502 Remove the G_GNUC_STRFTIME format check
This does not work, since g_date_time_format() supports
non-standard extensions such as %:::z, and this has
broken several consumers which use format errors, such
as ostree.
2018-11-01 12:00:58 -04:00
Philip Withnall
bfc661a1db Merge branch 'tests-memory-leaks' into 'master'
Fix minor memory leaks in tests

See merge request GNOME/glib!440
2018-11-01 11:59:59 +00:00
Tomasz Miąsko
b7571d5f0f tests: Fix GVariantType leak in GAction tests 2018-11-01 12:15:09 +01:00
Tomasz Miąsko
52bab0254a tests: Fix GOptionContext leak in GSubprocess tests 2018-11-01 12:14:52 +01:00
Tomasz Miąsko
9347c7630f tests: Fix GRand leak in GMenuModel tests 2018-11-01 12:14:09 +01:00
Philip Withnall
afce4ef36b Merge branch 'flags_validation_fix' into 'master'
gobject/genums.c: fix flags validation

Closes #1572

See merge request GNOME/glib!401
2018-11-01 10:46:29 +00:00
Arthur Demchenkov
aa1415c0df Add unit test for flags validation 2018-11-01 01:41:32 +03:00
Arthur Demchenkov
1d6c7843ca gobject/genums.c: fix flags validation
gint -> glong conversion causes flags to be invalid if the highest bit
is set.

Closes #1572
2018-11-01 01:41:32 +03:00
Philip Withnall
4f81c9eb97 Merge branch 'gdate-timezone' into 'master'
gdatetime: Fix formatting of time zones offsets in range -01:00 to +00:00

See merge request GNOME/glib!435
2018-10-31 22:35:00 +00:00
Philip Withnall
e7738e46a8 Merge branch 'mr/issue-1575' into 'master'
Enable compile time check of g_date_time_format() format

See merge request GNOME/glib!412
2018-10-31 22:23:50 +00:00
Philip Withnall
da790bc6da Merge branch 'gvariant' into 'master'
Fix ^*ay handling in g_variant_iter_loop()

See merge request GNOME/glib!417
2018-10-31 22:16:02 +00:00
Olivier Brunel
63e09d5251 valgrind: Add glib_init()-related suppressions 2018-10-31 19:43:59 +01:00
Christophe Fergeau
bd6d603398 test-gvariant: Add missing spaces before parens
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-31 18:44:21 +01:00
Christophe Fergeau
38d48b818a test-gvariant: Add and use assert_cmpstrv helper
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-31 18:44:21 +01:00
Christophe Fergeau
422d83cbaa test-gvariant: Remove some hardcoded strings
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-31 18:43:19 +01:00
Christophe Fergeau
572f78b649 test-gvariant: Use g_assert_* rather than g_assert()
This is desirable both to get more detailed failure messages; and
because g_assert() is compiled out when compiling with G_DISABLE_ASSERT,
which renders the tests useless.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-31 18:43:17 +01:00
Christophe Fergeau
e6e04d3b15 test-gvariant: Use gsize for loop indices
gint is not the best type when looping from 0 to N > 0, which usually is
the case in loops.  There are a few cases in this patch where guint is
used rather than gsize, this is when the index is used in a printf-like
function as this makes the format string easier to read

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-31 18:41:00 +01:00
Christophe Fergeau
b0a013e20e gvariant: Handle ^ay, ^&ay, ^aay, ^a&ay in g_variant_valist_free_nnp
g_variant_valist_free_nnp does not take into account ^*ay, which causes
crash when trying to use these types together with
g_variant_iter_loop().
2018-10-31 18:38:11 +01:00
Tomasz Miąsko
54c394a73f gdatetime: Fix formatting of time zones offsets in range -01:00 to +00:00
Formatting code for `%z` specifier incorrectly assumed that sign of
offset from UTC can be recovered from the number of hours alone, which
is not true for offsets between -01:00 and +00:00.

Extract and format sign separately to avoid the problem.

Issue #1337.
2018-10-31 15:02:22 +01:00
Christian Persch
ae02adc3c3 gdatetime: Enable compile time check of g_date_time_format() format
By annotating it with G_GNUC_STRFTIME.

https://gitlab.gnome.org/GNOME/glib/issues/1575
2018-10-31 11:50:07 +01:00
Christian Persch
d62a07831c gmacros: Add G_GNUC_STRFTIME macro
Analogous to G_GNUC_PRINTF and G_GNUC_SCANF, to annotate
functions similar to strftime.

https://gitlab.gnome.org/GNOME/glib/issues/1575
2018-10-31 11:50:07 +01:00
Christophe Fergeau
7d1b94d71a test-gvariant: Add test for ^ay, ^&ay, ^aay, ^a&ay
This will exhibit bugs in g_variant_valist_free_nnp() as these types are
not properly handled.
2018-10-30 21:04:08 +01:00
Simon McVittie
4e058a698a meson: Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 on GNU/Linux if needed
armv5 Linux systems implement __sync_bool_compare_and_swap() and
friends by calling a function provided by the kernel. This is not
technically an atomic intrinsic, so gcc doesn't define
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 in this case, but it's good
enough for us. Extend the current Android special case to cover
GNU/Linux too.

The possibilities are:

* __sync_foo detected and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 predefined:
  calls to __atomic_foo or __sync_foo primitives are inlined into user
  code by gatomic.h

* __sync_foo detected but __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not
  predefined: user code has an extern reference to g_atomic_foo(),
  which calls __atomic_foo or __sync_foo because we defined
  __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 when compiling GLib itself

* Windows: user code has an extern reference to g_atomic_foo(),
  which calls InterlockedFoo()

* !defined(G_ATOMIC_LOCK_FREE): user code has an extern reference to
  g_atomic_foo(), which emulates atomic operations with a mutex

Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #1576
2018-10-30 17:20:43 +00:00
Simon McVittie
361fed5d75 Merge branch 'fix-mainloop-test' into 'master'
mainloop-test: Fix race conditions

Closes #1530

See merge request GNOME/glib!429
2018-10-30 16:43:13 +00:00
Philip Withnall
ff8b731639 gkeyfile: Fix parsing of new lines in comments
Previously, the code which parsed comments in key files would append a
line break to the comment where there was none before; this was part of
the code for handling re-inserting line breaks into multi-line comments
after removing the ‘#’ prefix. Now, we don’t add a terminal line break.

This was slightly icky to implement because parse_value_as_comment() is
called once for each line of a multi-line comment.

This expands the existing test case to cover a single line comment, and
also fixes the documentation to correctly state that the leading ‘#’
*is* removed and mention the new line break behaviour.

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

https://gitlab.gnome.org/GNOME/glib/issues/107
2018-10-30 11:55:30 +00:00
Philip Withnall
09799a8b25 Merge branch 'meson-test-cleanup' into 'master'
Meson: Cleanup a FIXME now that we have dict addition

See merge request GNOME/glib!418
2018-10-30 11:33:20 +00:00
Philip Withnall
f65adb48e1 Merge branch 'gdate-reinitialize' into 'master'
gdate: Reinitialize using_twodigit_years and locale_era_adjust.

See merge request GNOME/glib!425
2018-10-30 11:00:41 +00:00
Tomasz Miąsko
88f36a1d6f mainloop-test: Fix race conditions
* Wait for adder threads before deallocating crawler_array and
  context_array to avoid use after-free and data race.
* Handle spurious wakeups around g_cond_wait.
* Avoid starting recurser_idle without context.

Fixes issue #1530.
2018-10-30 00:55:14 +01:00
Tomasz Miąsko
a8fd91aae5 gdate: Reinitialize locale information in g_date_prepare_to_parse.
When g_date_set_parse was used with more than one locale it could
incorrectly retain information from previous one. Reinitialize all
locale specific data inside g_date_prepare_to_parse to avoid the issue.
2018-10-30 00:24:40 +01:00
Philip Withnall
d512c0fe43 Merge branch 'wjt/gdbus-codegen-add-autocleanup-for-FooObject' into 'master'
gdbus-codegen: add autocleanup for FooObject

See merge request GNOME/glib!420
2018-10-29 23:12:41 +00:00
Will Thompson
745422afac gdbus-codegen: add autocleanup for FooObject
This is only enabled with `--c-generate-autocleanup all` for the
reasons discussed on https://bugzilla.gnome.org/show_bug.cgi?id=763379.
2018-10-29 22:48:26 +00:00
Will Thompson
5b78c3fdff gdbus-codegen: test generating autocleanups
This is the most degenerate possible test but it does exercise this code
path.

(Tweaked by Philip Withnall <withnall@endlessm.com> to also add the flag
to the autotools build.)
2018-10-29 22:48:26 +00:00
Philip Withnall
c1b3177461 Merge branch '827-main-context-docs' into 'master'
gmain: Clarify that g_source_set_callback() is safe on attached sources

Closes #827

See merge request GNOME/glib!426
2018-10-29 22:32:51 +00:00
Philip Withnall
58b96353f4 Merge branch 'issue-1562' into 'master'
tests: Update month name check for Lithuanian locale

Closes #1562

See merge request GNOME/glib!373
2018-10-29 22:22:27 +00:00
Philip Withnall
bfe5906b40 gmain: Clarify that g_source_set_callback() is safe on attached sources
g_source_set_callback() and g_source_set_callback_indirect() are both
safe to call zero or more times on attached sources. The change in
callback will take effect the next time the source is dispatched, after
the set_callback() call returns (it could block due to locking).

https://gitlab.gnome.org/GNOME/glib/issues/827
2018-10-29 22:10:33 +00:00
Philip Withnall
c2501a81f8 Merge branch 'ossfuzz-9672-markup-overflow' into 'master'
GMarkup buffer overflow fixes for error handling, round 2

See merge request GNOME/glib!422
2018-10-29 22:03:05 +00:00
Philip Withnall
89ee8bfdee Merge branch 'wip/lantw/check-getauxval-for-freebsd-12' into 'master'
gutils: Check whether getauxval function exists

See merge request GNOME/glib!423
2018-10-29 15:59:09 +00:00
Ting-Wei Lan
295964a380 gutils: Check whether getauxval function exists
FreeBSD 12 adds a new header, sys/auxv.h, to declare a function, elf_aux_info,
for public use, which was considered an internal function in previous releases.
This new function provides similar functionality with glibc getauxval, which is
also declared in the same header, but their interfaces are not compatible. Since
the only usage of sys/auxv.h is in g_check_setuid and FreeBSD already has
issetugid to provide the required functionality, we fixes the compilation error
by adding a check for getauxval function to prevent g_check_setuid from calling
getauxval when sys/auxv.h is found but getauxval is not available.

https://reviews.freebsd.org/D12743
https://reviews.freebsd.org/rS324815
2018-10-29 14:57:24 +00:00
Emmanuele Bassi
6e77089337 Merge branch 'fix-ci' into 'master'
ci: Fix Docker image version

See merge request GNOME/glib!424
2018-10-29 14:50:41 +00:00
Philip Withnall
304f84ba46 ci: Fix Docker image version
Someone uploaded a v9 image to the registry without updating the CI
YAML.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-29 13:30:28 +00:00
Philip Withnall
1a7f07f6bf tests: Rework markup parsing test to not stop on first failure
Previously, the markup parsing test would load a given markup file and
try to parse it several ways. It would return as soon as one of the
attempts failed — meaning that bugs only seen with non-nul-terminated,
or differently chunked, parse runs could never be caught.

Rework the tests so that all markup files are tested all ways, and we
assert that all ways of parsing them give the same result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-26 23:23:00 +13:00
Philip Withnall
2187b1bec4 gmarkup: Fix validation of element names
Previously, the element name validation only happened if a start_element
callback was specified on the context. Element name validation should be
unconditional.

This was causing test-5.gmarkup to fail when run against the improved
tests in the following commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-26 23:23:00 +13:00
Philip Withnall
3a961236dd gmarkup: Avoid reading off the end of a buffer when non-nul-terminated
When extracting a UTF-8 character to put in an error message on parse
failure, pass the remaining buffer length to utf8_str() to avoid it
running off the end of the input buffer. It previously assumed that the
buffer was nul-terminated, which was the case in all the tests until
now.

A following commit will add test coverage for this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-26 23:08:43 +13:00
Philip Withnall
f502141f98 tests: Run GMarkup tests with and without nul-termination
When using GMarkup to parse a string, the string can be provided with an
explicit length specified, or with no length and a nul terminator
instead. Run all the GMarkup tests both ways, to catch problems with
length checks, or with nul terminator checks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-26 22:57:07 +13:00
Philip Withnall
d6f2462ee0 tests: Add another GMarkup test from oss-fuzz
This doesn’t trigger any new failures, but is distinct from other tests
we have, so would be good to retain.

Related to commit cec7170540.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-26 22:57:07 +13:00
Matej Urbančič
7c09bcb3d5 Updated Slovenian translation 2018-10-25 21:35:53 +02:00
Xavier Claessens
aff686a2fb Meson: Cleanup a FIXME now that we have dict addition 2018-10-25 10:50:10 -04:00