Commit Graph

22275 Commits

Author SHA1 Message Date
Simon McVittie
fca9824978 glib-unix: Assert that our portable types correspond to ssize_t and pid_t
If this fails to compile on some particularly bizarre Unix platform,
we can relax these assertions; but our expectation is that gssize is
POSIX ssize_t, and that on Unix, GPid is POSIX pid_t.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-02 15:45:44 +01:00
Simon McVittie
bd1e2a984e glib-init: Statically assert more facts about standard types
This is a step towards glib#1484. We officially require a C99 toolchain,
so we can statically assert that our artisanal hand-crafted integer
types are compatible with the ones we would like to recommend people
use instead.

If there are *still* platforms where <stdint.h> is problematic, these
static assertions can act as an early-warning that future GLib releases
will make a C99-compliant <stdint.h> a hard requirement, in ways that
are less straightforward to avoid (see glib#1484 and glib!1300).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-02 15:45:40 +01:00
Yuri Chornoivan
f01ca92821 Update Ukrainian translation 2020-10-01 16:56:10 +00:00
Philip Withnall
37d04c2f6b Merge branch 'appinfo-shellany' into 'master'
GWin32AppInfo: Support verbs other than "open"

See merge request GNOME/glib!1502
2020-10-01 16:37:36 +00:00
Philip Withnall
e9c7ebe132 Merge branch 'wip/tingping/pkcs11' into 'master'
gtlscertificate: Add support for PKCS #11 backed certificates

See merge request GNOME/glib!1663
2020-10-01 16:34:55 +00:00
Руслан Ижбулатов
106e78af97 GWin32AppInfo: Support verbs other than "open"
This combines a massive code re-folding with functionlity expansion
that allows us to track multiple verbs per handler or per application.

Also fixes a few issues and removes a function that made no sense.
2020-10-01 17:18:03 +01:00
Руслан Ижбулатов
b01521b4cd gwin32registrykey: Fix returning subkey_name in subkey_iter_get_name() 2020-10-01 17:18:03 +01:00
Patrick Griffis
f9fc29f0b7 gtlscertificate: Add support for PKCS #11 backed certificates
This reverts commit d58e5de9e9.
2020-10-01 17:09:04 +01:00
Philip Withnall
42961e819d Merge branch 'wip/smcv/invocation-handled' into 'master'
GDBus: Add G_DBUS_METHOD_INVOCATION_HANDLED, _UNHANDLED

See merge request GNOME/glib!1603
2020-10-01 15:50:16 +00:00
Simon McVittie
38a2aed5f0 GDBus: Use G_DBUS_METHOD_INVOCATION_HANDLED in method implementations
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 16:32:50 +01:00
Simon McVittie
d65c8c30a9 GDBus: Add G_DBUS_METHOD_INVOCATION_HANDLED, _UNHANDLED
Like G_SOURCE_REMOVE and G_SOURCE_CONTINUE, these make it clearer what
it means to return TRUE or FALSE.

In particular, in GDBus methods that fail, the failure case still needs
to return TRUE (unlike the typical GError pattern), leading to comments
like this:

    g_dbus_method_invocation_return_error (invocation, ...);
    return TRUE;    /* handled */

which can now be replaced by:

    g_dbus_method_invocation_return_error (invocation, ...);
    return G_DUS_METHOD_INVOCATION_HANDLED;

G_DBUS_METHOD_INVOCATION_UNHANDLED is added for symmetry, but is very
rarely (perhaps never?) useful in practice.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 16:32:50 +01:00
Simon McVittie
500d065f3d GDBus tests: Use G_SOURCE_REMOVE, G_SOURCE_CONTINUE
The meaning of the boolean result of a GSource function is clearer if
we use these aliases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 16:32:50 +01:00
Emmanuele Bassi
51a135a272 Merge branch 'version-bump-2.68' into 'master'
Add version macros for 2.68

See merge request GNOME/glib!1674
2020-10-01 15:30:47 +00:00
Philip Withnall
854abcd1af Merge branch 'optdeps' into 'master'
Make libelf dependency optional via meson feature

See merge request GNOME/glib!1650
2020-10-01 13:47:36 +00:00
Niklas Gürtler
aa0e120174 Make libelf dependency optional via meson feature 2020-10-01 13:47:36 +00:00
Philip Withnall
06dabe05b1 Merge branch '2210-private-replace-destroy' into 'master'
gthread: Destroy value after replacing it in g_private_replace()

Closes #2210

See merge request GNOME/glib!1667
2020-10-01 13:43:52 +00:00
Philip Withnall
c51a8ce8c8 gversionmacros: Add version macros for GLib 2.68
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 14:33:21 +01:00
Philip Withnall
a36c98fe83 Merge branch 'add-back-win32-coverage' into 'master'
CI: Re-enable code coverage reporting for MSYS2 builds

See merge request GNOME/glib!1673
2020-10-01 13:32:51 +00:00
Philip Withnall
e0fd2e3f6a build: Post-release version bump to 2.67.0
Ready for the new unstable release series.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 14:26:51 +01:00
Christoph Reiter
7d1e782c65 CI: Re-enable code coverage reporting for MSYS2 builds
It was disabled in !875 because lcov didn't support the new coverage
format produced by gcc9+. The latest lcov release in MSYS2 supports
it again, so re-enable everything.

lcov now writes native Windows paths to its output so adjust the path
fixup script to handle those.
2020-10-01 14:07:14 +02:00
Sebastian Dröge
d536afeed8 Merge branch 'ossfuzz-22758-date-negative-overflow' into 'master'
gdatetime: Avoid integer overflow creating dates too far in the past

See merge request GNOME/glib!1671
2020-10-01 11:08:19 +00:00
Philip Withnall
281f6697c1 tests: Test date overflow failure with bookmark file parsing
This is exactly the test case from oss-fuzz which triggers a negative
overflow when constructing dates.

oss-fuzz#22758

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 11:46:23 +01:00
Philip Withnall
b5656d2524 gdatetime: Avoid integer overflow creating dates too far in the past
oss-fuzz#22758

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 11:46:15 +01:00
Philip Withnall
5464c4d292 Merge branch 'ossfuzz-23816-uri-parsing' into 'master'
guri: Fix URI scope parsing

See merge request GNOME/glib!1669
2020-10-01 10:14:45 +00:00
Philip Withnall
6762312ff2 tests: Add additional URI scope parsing tests
This bumps the coverage of `parse_host()` and `parse_ip_literal()` up to
100% of lines and branches.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 19:42:26 +01:00
Philip Withnall
d2f324545b tests: Rework test_uri_parsing_absolute to support failure tests
This introduces no tests for failed parsing *yet*, but will allow them
to be added in future.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 19:39:30 +01:00
Philip Withnall
b43fb9cbfb guri: Fix URI scope parsing
The previous parsing code could read off the end of a URI if it had an
incorrect %-escaped character in.

Fix that, and more closely implement parsing for the syntax defined in
RFC 6874, which is the amendment to RFC 3986 which specifies zone ID
syntax.

This requires reworking some network-address tests, which were
previously treating zone IDs incorrectly.

oss-fuzz#23816

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 19:39:30 +01:00
Philip Withnall
c363c3a9a5 tests: Remove duplicate IPv6 zone ID URI parsing tests
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 19:39:09 +01:00
Philip Withnall
7e400a886e guri: Refactor error handling in parse_ip_literal()
Having the goto labels at the bottom of a function makes things a little
more readable. This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 19:39:09 +01:00
Philip Withnall
17a53f2fc7 guri: Simplify memory management in parse_host()
This introduces no functional changes, but makes the memory ownership a
little clearer and reduces the length of the code.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 17:46:27 +01:00
Philip Withnall
58fce4b92b guri: Move IP-literal parsing out into a separate function
This introduces no functional changes, but will make future changes to
the code a little cleaner.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-30 17:45:19 +01:00
Philip Withnall
aa6aa0de42 Merge branch '2209-fix-parse-res-text' into 'master'
gthreadedresolver: Fix logic in parse_res_text()

Closes #2209

See merge request GNOME/glib!1664
2020-09-30 15:45:06 +00:00
Philip Withnall
8c76bec779 gthread: Destroy value after replacing it in g_private_replace()
If the old value is destroyed before updating the TLS value in pthreads
(or the Windows equivalent) then there’s a risk of infinite recursion if
`g_private_replace()` is called from within the `GDestroyNotify`.

Avoid that by destroying the old value after doing the TLS update.

Thanks to Matthias Clasen for diagnosing the issue.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2210
2020-09-30 16:16:11 +01:00
Philip Withnall
2d788652fd Merge branch 'fix-win32-g-module-symbol-flaky' into 'master'
Fix g_module_symbol() under Windows sometimes not succeeding

Closes gtk#3213

See merge request GNOME/glib!1665
2020-09-30 14:30:15 +00:00
Christoph Reiter
6a903ff6d7 Fix g_module_symbol() under Windows sometimes not succeeding
g_module_symbol() internally calls CreateToolhelp32Snapshot() which
in some circumstances returns ERROR_BAD_LENGTH and according to the docs
should lead to CreateToolhelp32Snapshot() being retried by the caller.

This retry logic was missing and for example led to g_module_symbol()
not succeeding if another thread happened to call the wrong function
at the wrong time.

This got noticed in the g-i build of gtk4 where g-i would call g_module_symbol()
on all gtk4 _get_type symbols and while inspecting the properties gtk4 would
spawn a thread calling SHGetSpecialFolderLocation() somewhere down the line.
During the call to SHGetSpecialFolderLocation() CreateToolhelp32Snapshot() would
return with ERROR_BAD_LENGTH for a short period of time and make g_module_symbol()
fail, which lead to "Invalid GType function" errors in g-i.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3213
2020-09-30 09:57:40 +02:00
Yosef Or Boczko
010569b373 Update Hebrew translation 2020-09-28 20:43:35 +00:00
Peter Bloomfield
a3b5e188aa gthreadedresolver: Fix logic in parse_res_text()
and avoid a sign-compare warning.

Fixes #2209
2020-09-26 11:11:44 -04:00
Philip Withnall
f2df054673 Merge branch 'wip/oholy/trash-recursion' into 'master'
gio-tool-trash: Prevent recursion to speed up emptying trash

See merge request GNOME/glib!1654
2020-09-24 05:59:43 +00:00
Ondrej Holy
f474ec1f72 gio-tool-trash: Prevent recursion to speed up emptying trash
Emptying trash over `gio trash` is a bit slow in comparison to plain
`rm -r`. On my system, it took about 3 min to empty the trash with a
folder containing 600 000 files, which is not ideal as `rm -r` call
took just a few seconds. I found that `g_file_delete` is implemented
differently for locations provided by the trash backend. The trash
backend prevents modifications of trashed content thus the delete
operation is allowed only for the top-level files and folders. So it
is not necessary to recursive delete all files as the permission
denied error is returned anyway. Let's call `g_file_delete` only for
top-level items, which reduces the time necessary for emptying trash
from minutes to seconds...

See: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1589
2020-09-23 15:35:47 +02:00
Philip Withnall
53819d8a37 Merge branch 'list-free-docs' into 'master'
glist: Clarify that g_list_free() and friends only free an entire list

See merge request GNOME/glib!1657
2020-09-23 12:42:07 +00:00
Sebastian Dröge
45758e04b7 Merge branch '2204-timezone-caching' into 'master'
gtimezone: Cache timezones based on the identifier they were created by

Closes #2204

See merge request GNOME/glib!1660
2020-09-23 10:50:11 +00:00
Philip Withnall
cd1b09fe30 Merge branch 'gutils-limit-scope' into 'master'
utils: Limit the scope of the variable `max`

See merge request GNOME/glib!1658
2020-09-23 10:39:45 +00:00
Philip Withnall
851241f19a gtimezone: Cache timezones based on the identifier they were created by
Rather than invalidating the cache by comparing `TZ` to the cached
timezone identifier, key entirely off the value of `TZ` (and a cached
copy of it).

This fixes the timezone cache being constantly invalidated if `TZ` is
`NULL` (which will always differ from the identifier of the default
local timezone which is constructed from `g_time_zone_new (NULL)`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2204
2020-09-23 11:28:32 +01:00
Philip Withnall
af0b0e98da Merge branch 'trash-portal-error' into 'master'
trash portal: Handle portal failures

See merge request GNOME/glib!1652
2020-09-23 09:36:32 +00:00
Peter Bloomfield
e64293d56c utils: Limit the scope of the variable max
in g_get_host_name(), and avoid an unused-variable warning when
_SC_HOST_NAME_MAX is not defined.
2020-09-22 16:14:21 -04:00
Stas Solovey
298b712b27 Update Russian translation 2020-09-22 19:46:32 +00:00
Philip Withnall
6248039403 Merge branch 'wip/issue2205' into 'master'
glocalfile: Never require G_LOCAL_FILE_STAT_FIELD_ATIME

Closes #2205 and #2189

See merge request GNOME/glib!1648
2020-09-22 15:51:03 +00:00
Philip Withnall
eb19c328f3 glist: Clarify that g_list_free() and friends only free an entire list
They shouldn’t be used to free a list from part-way through, as that
is confusing and will leave a dangling pointer from the previous list
element.

Spotted by Gary Kramlich in !1653.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-22 16:41:55 +01:00
Efstathios Iosifidis
76dfe085e4 Update Greek translation 2020-09-21 20:07:27 +00:00
Juliano de Souza Camargo
940f3ef9c9 Update Portuguese translation 2020-09-21 14:25:27 +00:00