Commit Graph

22266 Commits

Author SHA1 Message Date
Dušan Kazik
0e8066e350 Update Slovak translation 2020-10-13 12:43:21 +00:00
Sebastian Dröge
99e334654a Merge branch 'backport-1687-uri-annotations-glib-2-66' into 'glib-2-66'
uri: add missing (not)nullable annotations

See merge request GNOME/glib!1689
2020-10-13 08:50:50 +00:00
Marc-André Lureau
ed6ef00c13 uri: add missing (not)nullable annotations
As suggested by Sebastian Dröge:
https://github.com/gtk-rs/glib/pull/697#pullrequestreview-505797722

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-10-13 09:19:10 +01:00
Cheng-Chia Tseng
3248b7b670 Update Chinese (Taiwan) translation 2020-10-12 14:56:48 +00:00
Juliano de Souza Camargo
794af4ee4b Update Portuguese translation 2020-10-11 14:29:24 +00:00
Sebastian Dröge
3a6302c32a Merge branch 'backport-1684-fstatat-macos-glib-2-66' into 'glib-2-66'
Backport !1684 “glocalfileinfo: Fix use of fstatat() on macOS < 10.10” to glib-2-66

See merge request GNOME/glib!1685
2020-10-07 14:22:10 +00:00
Philip Withnall
d96a455b91 glocalfileinfo: Fix use of fstatat() on macOS < 10.10
`g_local_file_fstatat()` needs to fall back to returning an error if
`fstatat()` isn’t defined, which is the case on older versions of macOS
(as well as Windows, which was already handled). Callers shouldn’t call
`g_local_file_fstatat()` in these cases. (That’s already the case.)

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

Fixes: #2203
2020-10-07 14:55:27 +01:00
Sebastian Dröge
4fe3389fbd Merge branch 'backport-1680-uri-escaping-glib-2-66' into 'glib-2-66'
Backport !1680 “guri: Fix UTF-8 validation when escaping URI components” to glib-2-66

See merge request GNOME/glib!1682
2020-10-07 13:29:38 +00:00
Philip Withnall
30a3a1360e guri: Add additional tests for scope ID parsing
These bump up the code coverage.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-05 14:49:22 +01:00
Philip Withnall
439b290878 guri: Fix UTF-8 validation when escaping URI components
The return value from `g_utf8_get_char_validated()` is a `gunichar`,
which is unsigned, so comparing it with `> 0` is always going to return
true, even for return values `(gunichar) -1` and `(gunichar) -2`, which
indicate errors.

Handle them more explicitly.

oss-fuzz#26083

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-05 14:49:22 +01:00
Philip Withnall
19d55caab7 tests: Refactor g_uri_escape_string() tests
This will allow more tests to be added easily in future. It introduces
no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-05 14:49:22 +01:00
Philip Withnall
b2f8ba8a11 2.66.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 14:16:20 +01: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
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
Juliano de Souza Camargo
b2d0d1015c Update Portuguese translation
(cherry picked from commit 82ed2f22de)
2020-09-21 14:06:17 +00:00
Nirbheek Chauhan
7b17c57a38 Merge branch '2019-10-28_Define_G_MSVC_SYMBOL_PREFIX_correctly_for_ARM' into 'master'
Define G_MSVC_SYMBOL_PREFIX correctly for ARM

See merge request GNOME/glib!1187
2020-09-18 18:35:10 +00:00
Wolfgang Stöggl
7e27162874 Define G_MSVC_SYMBOL_PREFIX correctly for ARM32
Symbols on x86 are prefixed with an underscore
but symbols on x64/ARM/ARM64 are not.

Relevant information concerning the prefixes for the architectures
can be found in the vcpkg project [1,2], where arm and arm64 builds
are part of the CI.

Specifically, _WIN64 is defined on Windows ARM64, so this issue is
only visible when building on ARM32.

[1] 08e74979df/ports/glib/fix-arm-builds.patch
[2] https://github.com/microsoft/vcpkg/pull/6116
2020-09-18 23:50:09 +05:30
Ryan Gonzalez
88032cb541 trash portal: Handle portal failures
Previously, only whether or not the D-Bus call itself succeeded was
checked, regardless of the result code from the actual trash operation.
2020-09-15 18:06:56 -05:00
Simon McVittie
642baa50fa glocalfile: Never require G_LOCAL_FILE_STAT_FIELD_ATIME
Some filesystems don't have meaningful access times under at least some
circumstances (see #2189, #2205). In this situation the traditional stat()
and related kernel interfaces have to put something meaningless in the
st_atime field, and have no way to signal that it is meaningless.

However, statx() does have a way to signal that the atime is meaningless:
if the filesystem doesn't provide a useful access time, it will unset
the STATX_ATIME bit (as well as filling in the same meaningless value
for the stx_atime field that stat() would have used, for compatibility).
We don't actually *need* the atime, so never include it in the required
mask. This was already done for one code path in commit 6fc143bb
"gio: Allow no atime from statx" to fix #2189, but other callers were
left unchanged in that commit, and receive the same change here.

It is not actually guaranteed that *any* of the flags in the
returned stx_mask will be set (the only guarantee is that items in
STATX_BASIC_STATS have at least a harmless compatibility value, even if
their corresponding flag is cleared), so it might be better to follow
this up by removing the concept of the required mask entirely. However,
as of Linux 5.8 it looks as though STATX_ATIME is the only flag in
STATX_BASIC_STATS that might be cleared in practice, so this simpler
change fixes the immediate regression.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2205
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-15 10:09:46 +01:00
Philip Withnall
9bc61def1f Merge branch 'fix_warnings' into 'master'
Fix various signedness warnings

See merge request GNOME/glib!1645
2020-09-14 08:30:52 +00:00
Emmanuel Fleury
16773d2702 Fix a signedness problem in glib/tests/date.c
glib/tests/date.c:778:17: error: comparison of integer expressions of
  different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’

  778 |   for (i = 0; i < G_N_ELEMENTS (check_years); i++)
      |                 ^
2020-09-14 10:11:44 +02:00
Emmanuel Fleury
33148e6bc3 Fix a signedness problem in glib/tests/collate.c
glib/tests/collate.c:300:17: error: comparison of integer expressions
  of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’

  300 |   for (i = 0; i < G_N_ELEMENTS (test); i++)
      |                 ^
2020-09-14 10:11:44 +02:00
Emmanuel Fleury
d49586cfa3 Fix signedness error in glib/gspawn.c
glib/gspawn.c:2252:16: error: comparison of integer expressions of
  different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}

 2252 |   if (argc + 2 > argv_buffer_len)
      |                ^
2020-09-14 10:11:44 +02:00