Commit Graph

21071 Commits

Author SHA1 Message Date
Simon McVittie
ef1035d9d8 gcredentialsprivate: Document the various private macros
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-28 19:54:08 +00:00
Emmanuele Bassi
1ad64e183f Merge branch '1911-flags-enums-leak' into 'master'
gparamspecs: Fix type class leaks on error handling paths

See merge request GNOME/glib!1189
2019-10-28 19:53:38 +00:00
Philip Withnall
22cf2c8f4c gtestutils: Add additional non-NULL check in g_assert_cmpmem()
The compiler can’t work out from the combination of other conditions
that it’s not possible for (m2 == NULL) to hold true when memcmp() is
called, so add an explicit condition.

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

Fixes: #1897
2019-10-28 17:36:36 +00:00
Philip Withnall
c73bd53eb8 Merge branch 'fbsd_build' into 'master'
Update documentation with FreeBSD build instructions

See merge request GNOME/glib!1120
2019-10-28 17:26:26 +00:00
Philip Withnall
1a3bba4670 gparamspecs: Fix type class leaks on error handling paths
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1911
2019-10-28 14:57:33 +00:00
Philip Withnall
57aaee76d5 docs: Add objcopy to example cross-compilation file
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1916
2019-10-28 12:11:12 +00:00
Philip Withnall
2d2e96dc51 tests: Use objcopy from the cross-compilation file, if configured
Otherwise we’ll end up using the host’s `objcopy`, which will output
object files in the wrong format.

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

Fixes: #1916
2019-10-28 12:08:48 +00:00
Emmanuele Bassi
ca1dbb38d8 tests: Do not init the default value
The call to g_param_value_set_default() will do that for us, now.
2019-10-26 14:06:31 +01:00
Emmanuele Bassi
f7824da85f Do not validate a GValue initialized with the default
There's really no point in going through validation, if we know the
value we're validating is coming straight from the GParamSpec.
2019-10-26 14:04:26 +01:00
Emmanuele Bassi
6ad799ac67 Constify g_param_value_defaults() argument
The GValue we pass in is supposed to not be modified by the GParamSpec.
2019-10-26 14:03:16 +01:00
Emmanuele Bassi
47d558baa7 Allow passing empty GValue to g_param_value_set_default()
Since we have the type of the GValue we're going to initialize, we can
allow passing an empty (but valid) GValue when retrieving the default
value of a GParamSpec.

This will eliminate additional checks and an unnecessary reset.
2019-10-26 14:01:16 +01:00
Philip Withnall
1bebba0430 Merge branch 'ossfuzz-10286-variant-parser-recursion' into 'master'
gvariant: Limit recursion in g_variant_parse()

See merge request GNOME/glib!1173
2019-10-25 17:44:24 +00:00
Philip Withnall
f343ec5f82 Merge branch 'gtimezone' into 'master'
syscall flood on every time*() function call

See merge request GNOME/glib!1105
2019-10-25 17:27:49 +00:00
rim
551e83662d gtimezone: Cache UTC and local TZ indefinitely
Previously, these GTimeZone objects were being cached in the `time_zones` cache, but dropped from it when their final ref was dropped (which was frequently). That meant additional reads of `/etc/localtime` next time they were created, which was noticeable on profiles. Keep a permanent ref to the UTC and local timezones.
2019-10-25 17:27:49 +00:00
Philip Withnall
a7242d4a5e gspawn: Port to g_poll() from select()
This removes the limitation of select() that only FDs with values lower
than FD_SETSIZE can be used. Previously, if the out/err pipe FDs had
high values (which could happen if a large process, like Firefox, was
spawning subprocesses while having a lot of FDs open), GLib would abort
due to an assertion failure in libc.

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

Fixes: #954
2019-10-25 16:36:45 +01:00
Sebastian Dröge
5e17a98d19 Merge branch 'source-thread-safety-docs' into 'master'
gmain: Clarify thread safety of some common GSource functions

See merge request GNOME/glib!1181
2019-10-25 14:16:34 +00:00
Sebastian Dröge
ab98d4e285 Merge branch 'wip/hadess/fix-api-docs-typo' into 'master'
gio: Fix typo in URL

See merge request GNOME/glib!1182
2019-10-25 13:35:37 +00:00
Bastien Nocera
0d3b1d55e9 gio: Fix typo in URL
Left-over quote in URL.
2019-10-25 15:09:08 +02:00
Philip Withnall
ca4dace62b gmain: Clarify thread safety of some common GSource functions
See https://stackoverflow.com/q/58555626/2931197.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-25 12:13:31 +01:00
Sebastian Dröge
2e9b2761d6 Merge branch 'main-context-pusher' into 'master'
gmain: Add GMainContextPusher convenience API

See merge request GNOME/glib!983
2019-10-24 11:58:34 +00:00
Sebastian Dröge
05be19b9f7 Merge branch 'wip/smcv/array-memcpy-ub' into 'master'
array: Avoid use of memcpy(dest, NULL, 0)

See merge request GNOME/glib!1180
2019-10-24 11:49:09 +00:00
Philip Withnall
d62c1dad22 Merge branch 'wip/array-doc-comments' into 'master'
Improve GPtrArray doc-comments

See merge request GNOME/glib!1179
2019-10-24 11:44:38 +00:00
Simon McVittie
3837b83f5a array: Avoid use of memcpy(dest, NULL, 0)
glibc declares memcpy() with the first two arguments (the pointers)
annotated as non-null via an attribute, which results in the undefined
behaviour sanitizer considering it to be UB to pass a null pointer
in the second argument, even if we are copying 0 bytes (and hence not
actually dereferencing the pointer).

This shows up in array-test when run with the undefined behaviour
sanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-24 12:08:20 +01:00
Simon McVittie
acbbe7b8c4 array: Add tests based on the g_ptr_array_sort[_with_data] doc-comments
Note that I deliberately haven't used g_autoptr here, because while we
encourage GLib users to use g_autoptr in their own code, GLib itself
still supports being compiled in environments like MSVC that can't
support g_autoptr.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-24 12:02:33 +01:00
Simon McVittie
ee13eb518d array: Fix handling of user_data in doc-comment
The user_data for g_ptr_array_sort_with_data is passed directly, not
with an extra layer of pointer like the data pointers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: 52c130f8
2019-10-24 11:57:29 +01:00
Simon McVittie
ef6fe191ac array: Remove unnecessary casts from doc-comments
Let's not encourage library users to sprinkle casts through their code
when they don't need to.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: 52c130f8
2019-10-24 11:57:13 +01:00
Jordi Mas
8a7b375216 Update Catalan translation 2019-10-23 21:58:05 +02:00
Philip Withnall
21f8f89820 gmain: Add GMainContextPusher convenience API
This is like `GMutexLocker`, in that if you are able to use
`g_autoptr()`, it makes popping a `GMainContext` off the thread-default
main context stack easier when exiting a function.

A few uses of `G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS` are needed to
avoid warnings when building apps against GLib with
`GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-23 11:35:58 +01:00
Philip Withnall
65ce1c3fcd glib: Ignore deprecations when declaring autocleanups
We may need to declare autocleanups for new types, which will be marked
as ‘deprecated’ if the code which includes GLib doesn’t declare a high
enough `GLIB_VERSION_MAX_ALLOWED`. Despite that, we still need to
declare the autocleanups.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-23 11:25:48 +01:00
Sebastian Dröge
d515a1e85a Merge branch '1813-option-context-annotations' into 'master'
goption: Add missing (array) annotation to add_main_entries()

Closes #1813

See merge request GNOME/glib!942
2019-10-22 10:05:06 +00:00
Sebastian Dröge
611ea6e805 Merge branch '1836-dbus-connection-docs' into 'master'
gdbusconnection: Clarify nullability in a documentation comment

Closes #1836

See merge request GNOME/glib!1003
2019-10-22 07:48:13 +00:00
Sebastian Dröge
9c7a8c76d0 Merge branch 'testfilemonitor-leaks' into 'master'
Fix some minor leaks in testfilemonitor

See merge request GNOME/glib!1167
2019-10-22 06:58:55 +00:00
Simon McVittie
3e517c0ab2 ci: Add libdbus development files to CI Docker images
We use these to test interoperability between libdbus and GDBus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-21 16:45:14 +01:00
Philip Withnall
b7e84fb903 testfilemonitor: Fix a trivial leak in the test
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1910
2019-10-18 17:02:57 +01:00
Philip Withnall
322347e103 Merge branch 'assert-finalize-test' into 'master'
tests: Add a test for g_assert_finalize_object()

See merge request GNOME/glib!1014
2019-10-18 15:46:33 +00:00
Sebastian Dröge
b0f43cc451 Merge branch '1903-mimeapps-test-race' into 'master'
Fix thread unsafety in GFileMonitorSource and mimeapps test

Closes #1903

See merge request GNOME/glib!1164
2019-10-18 15:32:04 +00:00
Philip Withnall
31f9249528 tests: Add a test for g_assert_finalize_object()
A simple test just to double-check it works. See #488.

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

Helps: #488
2019-10-18 15:55:27 +01:00
Sebastian Dröge
f904587fcc Merge branch 'locale-docs' into 'master'
gcharset: Expand the documentation for g_get_locale_variants()

See merge request GNOME/glib!1163
2019-10-18 14:38:36 +00:00
Sebastian Dröge
51c3cf759e Merge branch 'timezone-test-toolbox' into 'master'
Fix gdatetime tests on toolbox

See merge request GNOME/glib!1168
2019-10-18 14:34:07 +00:00
Sebastian Dröge
bab6acff9b Merge branch 'atomic-strict-aliasing-fixes' into 'master'
Strict-aliasing fixes to new atomic built-ins

See merge request GNOME/glib!1155
2019-10-18 14:00:26 +00:00
Philip Withnall
25c2266a33 gvariant: Limit recursion in g_variant_parse()
The token parsing done by g_variant_parse() uses recursive function
calls, so at some point it will hit the stack limit. As with previous
changes to `GVariantType` parsing (commit 7c4e6e9fbe), limit the level
of nesting of containers parsed by g_variant_parse() to something
reasonable. We guarantee 64 levels of nesting, which should be enough
for anyone, and is the same as what we guarantee for types.

oss-fuzz#10286

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-18 13:53:18 +01:00
Will Thompson
43697d6b99 Revert "gdbus-codegen: emit GUnixFDLists if an arg has type 'h'"
This reverts commit 4aba03562b, preserving
the new tests but adjusting them to assert that the old behaviour is
restored.

As expected, there were a few projects which broke because of this.
Unfortunately, in one case the breakage crosses a project boundary:
sysprof ships D-Bus introspection XML, which is consumed by mutter and
passed through gdbus-codegen.

Since sysprof cannot add this annotation without breaking its existing
users, a warning is also not appropriate.

https://gitlab.gnome.org/GNOME/jhbuild/issues/41
https://gitlab.gnome.org/GNOME/sysprof/issues/17
https://gitlab.gnome.org/GNOME/glib/issues/1726
2019-10-18 10:30:00 +01:00
Philip Withnall
5dedc259b1 gtimezone: Clarify in docs that TZ can contain an absolute path
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-16 14:32:33 +01:00
Philip Withnall
c4d46d632f tests: Relax the time zone identifier tests
On closer reading of `man 3 timezone`, it’s actually permissible for
`TZ` to contain an absolute path which points to a tzfile file outside
the system time zone database. This is indeed what happens when building
GLib under Fedora’s toolbox, so relax that check in the tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-16 14:32:20 +01:00
Philip Withnall
3dec72b946 Merge branch 'wip/lantw/use-uname-as-a-fallback-to-get-os-info' into 'master'
Use uname as a fallback to get OS info

See merge request GNOME/glib!1165
2019-10-14 13:10:39 +00:00
Ting-Wei Lan
d219b3553c gutils: Use uname to report OS info when there is no os-release file
There are a lot of Unix-like systems which have not implemented the
os-release spec. On such system, we can use POSIX uname function as a
fallback to get basic information of the system.
2019-10-14 13:42:08 +01:00
Ting-Wei Lan
00abf67e2c gutils: Only use the default OS name on Linux
/etc/os-release is a spec designed for Linux. While other OSes can
implement it, it doesn't make sense to use Linux as the default value
on systems which don't use Linux.
2019-10-14 20:25:51 +08:00
Ting-Wei Lan
89ad9286d4 gutils: Do not translate OS names
The code is intended to provide an interface similar to /etc/os-release,
but /etc/os-release isn't designed to be translated.
2019-10-14 20:25:51 +08:00
Philip Withnall
493909b5e9 Merge branch 'osinfo' into 'master'
Add Windows support to g_get_os_info()

See merge request GNOME/glib!1160
2019-10-14 12:12:06 +00:00
Philip Withnall
592a13b483 glocalfilemonitor: Keep a weak ref to the monitor in GFileMonitorSource
Previously we were keeping a pointer to the `GFileMonitor` in a
`GFileMonitorSource` instance, but since we weren’t keeping a strong
reference, that `GFileMonitor` instance could be finalised from another
thread at any point while the source was referring to it. Not good.

Use a weak reference, and upgrade it to a strong reference whenever the
`GFileMonitorSource` is referring to the file monitor.

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

Helps: #1903
2019-10-11 22:31:24 +01:00