Commit Graph

18792 Commits

Author SHA1 Message Date
Christoph Reiter
0319dac01d g_binding_unbind: make it more introspection friendly; allow calling it multiple times. Fixes #1373
g_object_bind_property() (transfer none) returns a GBinding with an existing internal
reference which is active as long as the "binding" is. This allows to optionally use
the binding without any memory management, as it will remove itself when it is no longer
needed.

There are currently three ways to remove the "binding" and as a result the reference:

1) Either the source or target dies and we get notified by a weakref callback
2) The user unrefs the binding until it is destroyed (which is semi-legal,
   but worked and is used in the test suite)
3) The user calls g_binding_unbind()

In case (3) the problem was that it always calls unref even if the "binding" is already
gone, leading to crashes when called from bindings multiple times.
In #1373 and !197 it was noticed that a function always unrefs which would be a
"transfer full" annotation, but the problem here is that it should only remove the
ref when removing the "binding" and the annotation should stay "transfer none".

As a side effect of this fix it is now also possible to call g_binding_unbind() multiple
times where every call after the first is a no-op.

This also adds explicit tests for case (1) and (3) - only case (3) is affected by this change.
2018-08-16 11:27:34 +02:00
Ondrej Holy
4a77dd6799 Merge branch 'fix-overlayfs-trashing-1027' into 'master'
Fix trashing on overlayfs

Closes #1027

See merge request GNOME/glib!182
2018-08-13 18:01:31 +00:00
Iain Lane
1152d99ded Fix trashing on overlayfs
In order to determine whether to trash a file to the home directory, we
compare its st_dev to our home directory's st_dev field.

This is the wrong thing to do on overlayfs when deleting files, because
st_dev contains the ID of the filesystem providing the file (which can
be the lower or upper filesystem), but directories always return the ID
of the overlayfs. Thus the comparison fails and we are unable to trash
the file.

Fix this by checking st_dev of the parent directory when we are deleting
a file.

Also adjust `test_trash_not_supported` for this - make its st_dev check
look at the parent directory's `st_dev` rather than the temporary file's
own.

Fixes #1027.
2018-08-13 17:41:59 +01:00
Iain Lane
93f3cb7c6d Revert "glocalfile: Check that parent device is the same when trashing"
This reverts commit 15cdcd2e0b.
2018-08-13 17:23:21 +01:00
Arnaud B
438547641f Fix indicative gschema.dtd regarding range.
The range can have only a "min" or only a "max" attribute, and can even have no attributes at all.
2018-08-13 08:19:57 +00:00
Claude Paroz
ef45c909db Update French translation 2018-08-12 19:03:17 +00:00
Emmanuele Bassi
e49f9c9cd7 Merge branch '225-iso-8601-test-tz' into 'master'
tests: Explicitly set TZ=UTC for g_time_val_from_iso8601() testing

See merge request GNOME/glib!243
2018-08-12 11:55:08 +00:00
Emin Tufan Çetin
e98401f90f Update Turkish translation 2018-08-12 10:20:09 +00:00
Piotr Drąg
ae6439c83a Update Polish translation 2018-08-12 01:21:05 +02:00
Philip Withnall
f92359b593 Merge branch 'wjt/glib-mkenums-filename-basename-in-fhead-ftail' into 'master'
glib-mkenums: forbid @filename@/@basename@ in fhead and ftail

See merge request GNOME/glib!241
2018-08-11 21:25:05 +00:00
Philip Withnall
b1bfebc61c tests: Explicitly set TZ=UTC for g_time_val_from_iso8601() testing
Some of the test vectors don’t specify a timezone, so the local one is
used; the comparisons to the expected results (which are in UTC) then
fail.

See discussion in
https://gitlab.gnome.org/GNOME/glib/merge_requests/225.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-11 22:00:52 +01:00
Will Thompson
de62a95d5e
glib-mkenums: improve and correct argument documentation
ftail is not per-input-file, it is the footer for the entire output
file.

You cannot have fewer informations.
2018-08-10 17:18:36 +01:00
Will Thompson
7928fee2a8
glib-mkenums: don't support @filename@/@basename@ in fhead/ftail
As discussed in
https://gitlab.gnome.org/GNOME/glib/merge_requests/135#note_253986 it
doesn't really make sense to support these outside the templates for any
particular header file. Leave them unsubstituted, with a warning.
2018-08-10 17:05:59 +01:00
Will Thompson
cbd335c8c9
tests: mkenums: placate flake8 2018-08-10 17:05:59 +01:00
Will Thompson
12a2a984f2
tests: refactor running glib-mkenums
Part of runMkenumsWithHeader() was duplicated in test_reproducible(),
and would otherwise need to be duplicated again in upcoming tests.  Many
places duplicated decoding stdout/stderr and checking the exit code.

Introduce a named tuple for the returned fields; and factor out writing
a template file to pass with --template.
2018-08-10 17:05:59 +01:00
Xavier Claessens
cce309aebb Merge branch 'ossfuzz-9815-time-signed-arithmetic' into 'master'
gtimer: Ensure arithmetic is correctly signed for ISO 8601 parsing

See merge request GNOME/glib!240
2018-08-10 13:35:36 +00:00
Philip Withnall
8c844291b7 gtimer: Ensure arithmetic is correctly signed for ISO 8601 parsing
When calculating the value of a timezone offset, ensure that any offsets
done with negative numbers are done in a signed integer.

oss-fuzz#9815

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-10 10:43:37 +01:00
Emmanuele Bassi
0d271223d8 Merge branch '1481-variant-parse-overflow' into 'master'
gvariant: Fix bounds checking in GVariant text format parser

Closes #1481

See merge request GNOME/glib!236
2018-08-09 10:25:48 +00:00
LRN
8defa46e6e Merge branch 'issue-1452' into 'master'
Issue 1452

Closes #1452

See merge request GNOME/glib!235
2018-08-09 00:25:05 +00:00
Philip Withnall
10ee7301e8 gvariant: Fix bounds checking in GVariant text format parser
The token_stream_peek() functions were not doing any bounds checking, so
could potentially read 1 byte off the end of the input blob. This was
never noticed, since the input stream is almost always a nul-terminated
string. However, g_variant_parse() does allow non-nul-terminated strings
to be used with a @limit parameter, and the bugs become apparent under
valgrind if that parameter is used.

This includes modifications to the test cases to cover the
non-nul-terminated case.

Spotted by ossfuzz.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-09 01:08:46 +01:00
Руслан Ижбулатов
075bb0f751 W32: consider NTFS mounpoints to be symlinks
While mountpoints are *not* symlinks, strictly speaking,
they works in a similar enough way, so consider them to be
symlinks for the purpose of querying local file info.
2018-08-08 23:41:07 +00:00
Руслан Ижбулатов
929844fdf7 W32: correctly use st_ctime
On Windows st_ctime field is the file creation time.
POSIX mandates that field to be the file state change time.
Naturally, glib code interpreted st_ctime as POSIX suggested,
and the result was bad.
Fix this by introducing special W32-only logic for setting
attributes from st_ctime field.

Fixes issue #1452.
2018-08-08 23:41:02 +00:00
Emmanuele Bassi
291bb0c584 Merge branch '1433-rename-timezones-in-tests' into 'master'
tests: Don’t use a potentially-existent timezone in a test for failure

Closes #1433

See merge request GNOME/glib!213
2018-08-08 22:31:07 +00:00
Christoph Reiter
3693bc52ad Merge branch 'gtaskfix' into 'master'
DOC: Documentation fix in GTask description

See merge request GNOME/glib!234
2018-08-08 05:34:27 +00:00
Pavlo Solntsev
7e2dfa8c44 DOC: Documentation fix in GTask description 2018-08-08 00:17:15 -05:00
Philip Withnall
bc0d624245 Merge branch 'xclaesse/glib-meson-cross-doc'
Closes #1363

See merge request GNOME/glib!232
2018-08-07 16:53:08 +01:00
Xavier Claessens
f046801217 Meson: Update cross compilation doc
(Modified by Philip Withnall <withnall@endlessm.com> to improve
formatting on original.)

Closes #1363
2018-08-07 16:52:49 +01:00
Xavier Claessens
0498b43489 Merge branch '1446-g_test_init-docs' into 'master'
gtestutils: Mention G_DISABLE_ASSERT in documentation for g_test_init()

Closes #1446

See merge request GNOME/glib!212
2018-08-07 14:50:53 +00:00
Xavier Claessens
ba30f45d9a Merge branch 'timer-tests' into 'master'
Minor additions to gtimer.c tests

See merge request GNOME/glib!231
2018-08-07 14:43:43 +00:00
Philip Withnall
83c79eaf24 Merge branch 'smcv/glib-xfail'
Closes #1474

See merge request GNOME/glib!221
2018-08-07 12:24:16 +01:00
Simon McVittie
b8d751af3e testing: Exercise TAP output
(Tweaked by Philip Withnall <withnall@endlessm.com> to fix some minor
leaks, code formatting, and add a test comment.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-08-07 12:20:37 +01:00
Emmanuele Bassi
9ce18521aa Merge branch '1475-atomic-casts' into 'master'
tests: Fix a -Wbad-function-cast warning in the atomic tests

Closes #1475

See merge request GNOME/glib!223
2018-08-07 10:06:04 +00:00
Philip Withnall
ab09a5f5a9 gdbusmessage: Fix a typo in the documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-07 11:04:00 +01:00
Philip Withnall
6104e63ec4 tests: Improve branch coverage when testing g_time_val_add()
While I’m here…

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-07 11:03:39 +01:00
Philip Withnall
725eb1c86b tests: Add test for overflow handling in g_time_val_to_iso8601()
While I’m here…

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-07 11:03:39 +01:00
Emmanuele Bassi
7458defa9a Merge branch 'ossfuzz-9673-bookmark-date-overflow' into 'master'
gtimer: Add overflow checks to g_time_val_from_iso8601()

See merge request GNOME/glib!225
2018-08-07 09:57:21 +00:00
Philip Withnall
a5f824451f Merge branch 'mcatanzaro/tls-docs' into 'master'
Update TLS documentation

See merge request GNOME/glib!199
2018-08-07 09:46:30 +00:00
Philip Withnall
e5d9eca334 Merge branch 'gbytes-compare-docs' into 'master'
Fix up g_bytes_compare() documentation

See merge request GNOME/glib!229
2018-08-06 18:00:45 +00:00
Philip Withnall
2ab7fd2951 tests: Add more ISO 8601 parser tests
These come from looking at the code coverage data. We should now have
full branch coverage of the ISO 8601 parser.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 14:07:29 +01:00
Philip Withnall
fdccf5ff34 gtimer: Drop support for negative years from g_time_val_from_iso8601()
It never worked; we’ve always parsed the year with strtoul() (unsigned).
While negative years are supported by the ISO 8601 standard, they can
only be used by mutual agreement of the two parties interchanging data.
Moreover, they are not supported by GTimeVal, which is what we’re
filling with the results.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 14:07:29 +01:00
Philip Withnall
cefa66eb76 gtimer: Add overflow checks to g_time_val_from_iso8601()
The code was previously doing a few bits of arithmetic without checking
whether they would overflow, and hence not validating the date/time it
was parsing very strictly.

The parser is now not 100% strict, but should avoid any arithmetic
overflows which would cause an invalid result to be returned even though
g_time_val_from_iso8601() had returned TRUE.

oss-fuzz#9673

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 14:07:29 +01:00
Philip Withnall
b1fffbffbf gtimer: Document that g_time_val_from_iso8601() drops whitespace
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 14:07:29 +01:00
Philip Withnall
4eca2ac0ee tests: Add an overflow test for bookmark file dates
oss-fuzz#9673

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 14:07:27 +01:00
Emmanuele Bassi
eb65054aba Merge branch 'ossfuzz-9723-bookmark-leak' into 'master'
gbookmarkfile: Fix some more minor leaks when metadata elements are repeated

See merge request GNOME/glib!230
2018-08-06 12:54:04 +00:00
Philip Withnall
2860d4b50e gbookmarkfile: Fix some more minor leaks when metadata elements are repeated
oss-fuzz#9723

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-06 13:36:21 +01:00
Sebastian Dröge
a81b925d98 Fix up g_bytes_compare() documentation
It was declaring the opposite of what the function was actually doing,
and what every other comparison function is doing.
2018-08-06 15:20:02 +03:00
Aurimas Černius
0fba231a6b Updated Lithuanian translation 2018-08-05 23:25:59 +03:00
Michael Catanzaro
08fe93589e Update documentation of g_tls_client_connection_set_use_ssl3()
We now send the fallback SCSV, meaning use of this function will cause
modern servers to immediately terminate the connection, so let's warn
API users to expect that behavior and be crystal clear that this
function should only be used as a fallback when a normal connection
attempt has already failed.

Also, the documentation is mostly duplicated between the property and
the function, so let's just reference the function documentation from
the property.
2018-08-04 16:33:28 -05:00
Simon McVittie
54a5f37f12 g_test_run: Document g_test_incomplete's similarity to g_test_skip
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-08-03 14:33:52 +01:00
Simon McVittie
0a180bb51b testing: Assert that test-case results are combined correctly
This repurposes the existing skip-all test as "combining", since it
is no longer entirely about runs where every test-case was skipped.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-08-03 14:30:10 +01:00