Commit Graph

21407 Commits

Author SHA1 Message Date
Philip Withnall
8555aeec8d Merge branch 'wip/ci-style-check' into 'master'
CI: Code check formating in CI

Closes #1552

See merge request GNOME/glib!1237
2019-11-25 10:23:50 +00:00
Philip Withnall
812253a95f guuid: Document that g_uuid_string_random() is not secure
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1947
2019-11-25 10:10:36 +00:00
Pavlo Solntsev
e95f47c395
CI: Code check formating in CI 2019-11-21 14:03:01 -06:00
Philip Withnall
7b77439841 Merge branch 'wip/hadess/occurred' into 'master'
docs: Fix "occurred" typos in API documentation

See merge request GNOME/glib!1243
2019-11-21 12:45:45 +00:00
Philip Withnall
7c77cdf9ba Merge branch 'objcpy-version' into 'master'
Enable test about objcopy if it supports the --add-symbol parameter

Closes #1895

See merge request GNOME/glib!1236
2019-11-21 12:34:15 +00:00
Philip Withnall
6f3de72ad4 Merge branch 'th/gstrv-use-gsize' into 'master'
gstrfuncs: use gsize type internally for strv functions

See merge request GNOME/glib!1238
2019-11-21 12:33:34 +00:00
Iain Lane
50c215b14e Merge branch 'unix-mode-docs' into 'master'
gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE

See merge request GNOME/glib!1242
2019-11-21 12:24:32 +00:00
Bastien Nocera
6fd2ea1dc6 docs: Fix "occurred" typos in API documentation 2019-11-21 13:07:08 +01:00
Philip Withnall
94e8f027bd Merge branch '1004-lldb' into 'master'
Make gbacktrace use lldb on macOS

Closes #1004

See merge request GNOME/glib!167
2019-11-21 11:54:46 +00:00
Philip Withnall
0a469dafe4 Merge branch 'wip/iainl/fix-1934' into 'master'
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"

Closes #1934

See merge request GNOME/glib!1241
2019-11-21 11:27:20 +00:00
Philip Withnall
f793319b17 gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE
It’s not just the mode, it’s also the file type.

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

Helps: #1934
2019-11-21 11:24:08 +00:00
Ignacio Casal Quinteiro
5fe61e8c46 Enable test about objcopy if it supports the --add-symbol parameter
This fixes building in old systems like centos 6.

(With tweaks by Philip Withnall.)

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1895
2019-11-21 11:16:24 +00:00
Kristian Rietveld
1fbd185430 gbacktrace: on macOS support and default to LLDB
Tweaked by Philip Withnall <withnall@endlessm.com> to fix review issues.

Closes: #1004
2019-11-21 11:02:14 +00:00
Philip Withnall
9dc006cfc8 Merge branch '1940-atomic-types' into 'master'
tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()

Closes #1940

See merge request GNOME/glib!1234
2019-11-21 10:57:27 +00:00
Iain Lane
0c88825a75
test_copy_preserve_mode: Adjust for the previous revert
Now we're returning the file type again, we need to mask it out to
compare with the mode. We can also check that the statbuf said the file
is a regular file.

Related: #1934
2019-11-21 10:49:31 +00:00
Iain Lane
e330a99f7a
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"
This reverts commit bfdc5fc4fc.

This changes the semantics of G_FILE_ATTRIBUTE_ID_UNIX_MODE, and we've
already found one user of the previous semantics (ostree).

Closes #1934
2019-11-21 10:31:43 +00:00
Philip Withnall
a0d5b49ef7 Merge branch 'wip/hadess/gdatetime-leap-seconds' into 'master'
gdatetime: Add hack for leap seconds

Closes #1938

See merge request GNOME/glib!1233
2019-11-21 09:55:52 +00:00
Thomas Haller
c8194ee3ec gstrfuncs: use gsize type internally for strv functions
In C, the proper type for a heap allocate structure is size_t/gsize.
That means, no valid (heap allocated) pointer will ever contain more
bytes than size_t can represent.

Hence, this integer type should also be used when operating on
data like a strv array. Adjust some internal uses to use gsize
instead of gint/guint.

Note that g_strv_length() returns a value of type guint. So this
API cannot be used on string arrays longer of arbitrary size. But
that is not fixable.
2019-11-21 10:44:48 +01:00
Bastien Nocera
b4eaac5817 gdatetime: Handle leap seconds in ISO8601 dates
GDateTime doesn't handle leap seconds, so just round these down to
the previous second.

https://gitlab.gnome.org/GNOME/glib/issues/1938
2019-11-21 09:14:39 +01:00
Xavier Claessens
653d3e2c5d Merge branch 'mgl-fix-build' into 'master'
Fix build on old libc that does not define _SC_HOST_NAME_MAX

See merge request GNOME/glib!1231
2019-11-20 14:12:29 +00:00
Xavier Claessens
de79958295 Fix build on old libc that does not define _SC_HOST_NAME_MAX
Bionic (Android's libc) only added that symbol in Nov 2014, can't find
in which NDK release it got released.
2019-11-20 08:34:25 -05:00
Philip Withnall
21fce30e9a Revert "gatomic: Temporarily disable C11-style atomics on FreeBSD"
This reverts commit fd3ed5e31b.

C11-style atomics have been fixed (on FreeBSD and other platforms) in
the previous commit, “gatomic: Check argument width in
g_atomic_pointer_compare_and_exchange()”.

See !1229 and #1940.
2019-11-20 12:12:04 +00:00
Philip Withnall
75cd86f00e gatomic: Check argument width in g_atomic_pointer_compare_and_exchange()
Check that the new value is actually pointer-width, rather than (for
example) `sizeof (int)` which could happen if someone used `0` rather
than `NULL`.

Changes suggested by Simon McVittie.

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

Helps: #1940
2019-11-20 12:10:43 +00:00
Philip Withnall
844332ef31 tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()
Don’t pass integers; it’s not type-safe. The macro version of
`g_atomic_pointer_compare_and_exchange()` used to erroneously accept
integers, but they would have the wrong width on some platforms.

Changes originally investigated and suggested by Ting-Wei Lan.

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

Fixes: #1940
2019-11-20 12:10:23 +00:00
Philip Withnall
eadc17f894 Merge branch 'wip/ernestask/bz-693576-annotations' into 'master'
Make GTask more binding-friendly

See merge request GNOME/glib!1216
2019-11-20 11:17:35 +00:00
Michael Catanzaro
d3768c89ae Merge branch 'mcatanzaro/copy-session-state' into 'master'
Improve documentation for footgun function g_tls_client_connection_copy_session_state()

See merge request GNOME/glib!1039
2019-11-18 21:14:37 +00:00
Michael Catanzaro
88e7529101 Merge branch 'mcatanzaro/gtlsconnection-changes' into 'master'
Deprecate old GTlsConnection functionality even harder!

See merge request GNOME/glib!1227
2019-11-18 21:10:54 +00:00
Michael Catanzaro
fb54646899 Improve documentation of g_tls_client_connection_copy_session_state()
This function has numerous undocumented limitations. In particular, it
is not possible to ensure this function actually does anything. Document
these problems.
2019-11-18 13:55:34 -06:00
Michael Catanzaro
9d2c949b54 gtlsclientconnection: use-ssl3 is now ignored
For many years after SSL 3.0 support was removed, we used this function
to indicate that we should perform protocol version fallback to the
lowest-supported protocol version, to workaround protocol version
intolerance. Nowadays this is no longer needed, and support has been
removed from glib-networking, so update the documentation.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
8f88783a7f gtlsconnection: add missing G_PARAM_DEPRECATED
The use-system-certdb function has been deprecated since 2.30 and is
just missing the deprecation flag to warn developers.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
7b3824fa62 gtlsconnection: add missing deprecation annotation
GTlsConnection:rehandshake-mode has been deprecated since 2.60 using
the G_PARAM_DEPRECATED flag, but I forgot to add the right annotation to
the documentation. Oops.

The associated getter/setter functions were both deprecated properly.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
79999c8723 gtlsconnection: document rehandshake-mode is no longer supported 2019-11-18 13:52:39 -06:00
Philip Withnall
5054b48b7c gdbusmessage: Limit recursion of variants in D-Bus messages
This is the analogue of commit 7c4e6e9fbe, but applied to the
`GDBusMessage` parser, which does its own top-level parsing of the
variant format in D-Bus messages.

Previously, this code allowed arbitrary recursion of variant containers,
which could lead to a stack overflow. Now, that recursion is limited to
64 levels, as per the D-Bus specification:

https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-signature

This includes a new unit test.

oss-fuzz#14870

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-18 17:53:55 +00:00
Simon McVittie
4a57109b77 Merge branch '1940-bsd-atomics-failure' into 'master'
gatomic: Temporarily disable C11-style atomics on FreeBSD

See merge request GNOME/glib!1229
2019-11-15 20:23:41 +00:00
Philip Withnall
c577bc89cd gsignal: Warn if g_signal_lookup() is called on an invalid signal name
And add a test for it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
463a75c11e signals: Add tests for constructing signals with invalid names
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
cce274c0aa signals: Add tests for g_signal_lookup() and g_signal_parse_name()
They’ve never previously been formally tested.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
ccbe9690d3 gsignal: Fix typos in GSignalMatchType documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
5e89ba5a74 gsignal: Clarify signal detail format
The format has never previously been specified. It can be anything, but
for sanity’s sake disallow empty strings.

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

Helps: #358
2019-11-15 11:06:14 +00:00
Philip Withnall
fb5cd1828f signals: Use g_assert_*() in signals 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-15 11:06:14 +00:00
Philip Withnall
152547eb10 binding: Use g_assert_*() in binding 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-15 11:06:14 +00:00
Philip Withnall
f43f5892f5 binding: Rename some test properties to include hyphens
This will allow subsequent testing of property name canonicalisation.

This test introduces no functional changes.

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

Helps: #358
2019-11-15 11:06:14 +00:00
Philip Withnall
89f955db2d gsignal: Canonicalise signal names at installation time
Rather than adding a canonicalised and non-canonicalised version of the
signal to `g_signal_key_bsa`, just add the canonicalised version. Signal
lookups always use the canonicalised key (since the previous commit).

This saves space in `g_signal_key_bsa`, which should speed up lookups;
and it saves significant space in the global `GQuark` table (a 9.6%
reduction in entries in that table, by a rough test using
gnome-software).

We have to be a little more relaxed on the signal name validation than
we are for property name validation, as GTK installs a
`-gtk-private-changed` signal which violates the signal naming rules.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
875e2afa55 gsignal: Canonicalise signal name when looking it up in an object
Previously, we’d look up the signal name as passed to (for example)
`g_signal_lookup()`, and rely on the fact that signals are inserted
twice into `g_signal_key_bsa`; once in canonical form and once not.

In preparation for only inserting signals into `g_signal_key_bsa` once,
we now try looking up a signal with the given signal name and, if that
fails, try canonicalising the name and trying again.

This is a performance hit on lookups for non-canonical names, but
shouldn’t affect the performance of lookups for canonical names. If
people want performance, they should use canonical names.

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

Helps: #358
2019-11-15 11:06:14 +00:00
Philip Withnall
90b51805b7 gsignal: Fold g_quark_try_string() call into signal_id_lookup()
This eliminates a call from every call site of signal_id_lookup(). It
introduces no functional changes, but allows subsequent refactoring.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
b8eb6025f1 gsignal: Tidy up signal naming documentation
Since signal names are the same as property names, reference between the
two. Improve the formatting, and make it clearer that `_` is
discouraged.

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

Helps: #358
2019-11-15 11:06:14 +00:00
Philip Withnall
26970edc9f gbinding: Avoid a string copy of interned property names
Interned strings are never freed, so we don’t need to take a copy of
them when returning them in a #GValue. This is a minor memory allocation
improvement, with no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
ae27f50342 gbinding: Canonicalise source and target properties
Rather than interning a property name string which isn’t canonicalised,
canonicalise it first, and enforce stricter validation on inputs.

The previous code was not incorrect (since the property machinery would
have canonicalised the property names itself, internally), but would
have resulted in non-canonical property names getting into the GQuark
table unnecessarily. With the new code, the interned property names from
property installation time should be consistently reused.

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

Helps: #358
2019-11-15 11:06:14 +00:00
Philip Withnall
30e630c9df gparam: Tighten up property name validation
Inline with the stricter version of the property naming rules from the
documentation, tighten up the validation of property names at
installation time.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-15 11:06:14 +00:00
Philip Withnall
b8f4c3596c Merge branch 'mcatanzaro/gtlsconnection-confusion' into 'master'
gtlsconnection: clarify handshake() documentation

See merge request GNOME/glib!1225
2019-11-15 10:45:17 +00:00