Commit Graph

23442 Commits

Author SHA1 Message Date
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
Emmanuel Fleury
33bfae70ac Fix signedness problem in glib/gutils.c
glib/gutils.c:998:26: error: comparison of integer expressions of
 different signedness: ‘glong’ {aka ‘long int’} and ‘long unsigned int’
  998 |       if (max > 0 && max <= G_MAXSIZE - 1)
      |                          ^~
2020-09-14 10:11:44 +02:00
Rūdolfs Mazurs
b696dccb20 Update Latvian translation 2020-09-13 08:54:05 +00:00
Ask Hjorth Larsen
1d1262e81a Updated Danish translation 2020-09-12 01:11:23 +02:00
Philip Withnall
c3eda78ada Merge branch '2194-winhttp-file-display-name' into 'master'
gwinhttpfile: Set display-name attribute on file info

Closes #2194

See merge request GNOME/glib!1644
2020-09-11 09:49:04 +00:00
Philip Withnall
9d859f001d gutf8: Fix a typo in the docs for g_utf16_to_utf8()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-09-10 14:14:32 +01:00
Philip Withnall
6f9b379c08 gwinhttpfile: Set display-name attribute on file info
It is not allowed to be `NULL` or unset if requested by the file
attribute matcher. Derive it from the basename. This doesn’t handle the
situation of a failed UTF-16 to UTF-8 conversion very well, but will at
least return something.

Note that the `g_filename_display_basename()` function can’t be used as
`GWinHttpFile` provides its URI in UTF-16 rather than in the file system
encoding.

This fixes a crash when using GIMP on Windows. Thanks to lillolollo for
in-depth debugging assistance.

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

Fixes: #2194
2020-09-10 14:14:32 +01:00
Sebastian Dröge
b7c75f78ab Merge branch '2077-pointer-arithmetic' into 'master'
gfileutils: Correct operator precedence to avoid undefined pointer maths

Closes #2077

See merge request GNOME/glib!1526
2020-09-10 11:22:44 +00:00
Philip Withnall
aea8c91837 Merge branch 'wip/2164-dbus-sha1-timeout' into 'master'
gdbusauthmechanismsha1: Use the same timeouts as libdbus

Closes #2164

See merge request GNOME/glib!1641
2020-09-10 11:13:52 +00:00
Philip Withnall
f010a8c983 Merge branch 'coverity-fixes' into 'master'
Minor Coverity fixes

See merge request GNOME/glib!1643
2020-09-10 11:13:01 +00:00
Philip Withnall
c2c12e4292 2.66.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-09-10 11:39:49 +01:00
Milo Casagrande
bca2bdd867 Update Italian translation 2020-09-10 09:17:23 +00:00
Goran Vidović
496858c904 Update Croatian translation 2020-09-09 19:28:45 +00:00
Goran Vidović
81fd3fe4d9 Update Croatian translation 2020-09-08 21:17:06 +00:00
Goran Vidović
bd5efc8b0e Update Croatian translation 2020-09-08 16:09:23 +00:00
Philip Withnall
cbf72f0dc9 ci: Add model file for Coverity
This isn’t used in the build at all, it’s just a copy of the model file
which is uploaded in our Coverity configuration. This should be kept up
to date with changes in the file on the Coverity servers.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-09-08 10:34:54 +01:00
Philip Withnall
f19cb44b98 guri: Remove unnecessary NULL pointer check
`uri` is always non-`NULL` by the time the `fail` label is reached, so
drop the `NULL` pointer check. Inline the `fail` code since it’s only
used from two places.

Coverity CID: #1430970
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-09-08 09:59:24 +01:00
Goran Vidović
2effedd75b Update Croatian translation 2020-09-07 21:58:14 +00:00
Balázs Meskó
7fa8d5f746 Update Hungarian translation 2020-09-07 20:09:27 +00:00
Goran Vidović
6f69a79062 Update Croatian translation 2020-09-07 19:08:25 +00:00
Simon McVittie
92183fb703 gdbusauthmechanismsha1: Use the same timeouts as libdbus
For interoperability with libdbus, we want to use compatible timeouts.
In particular, this fixes a spurious failure of the `gdbus-server-auth`
test caused by libdbus and gdbus choosing to expire the key (cookie) at
different times, as diagnosed by Thiago Macieira. Previously, the libdbus
client would decline to use keys older than 7 minutes, but the GDBus
server would not generate a new key until the old key was 10 minutes old.

For completeness, also adjust the other arbitrary timeouts in the
DBUS_COOKIE_SHA1 mechanism to be the same as in libdbus. To make it
easier to align with libdbus, create internal macros with the same names
and values used in dbus-keyring.c.

* maximum time a key can be in the future due to clock skew between
  systems sharing a home directory
  - spec says "a reasonable time in the future"
  - was 1 day
  - now 5 minutes
  - MAX_TIME_TRAVEL_SECONDS

* time to generate a new key if the newest is older
  - spec says "If no recent keys remain, the server may generate a new
    key", but that isn't practical, because in reality we need a grace
    period during which an old key will not be used for new authentication
    attempts but old authentication attempts can continue (in practice both
    libdbus and GDBus implemented this logic)
  - was 10 minutes
  - now 5 minutes
  - NEW_KEY_TIMEOUT_SECONDS

* time to discard old keys
  - spec says "the timeout can be fairly short"
  - was 15 minutes
  - now 7 minutes
  - EXPIRE_KEYS_TIMEOUT_SECONDS

* time allowed for a client using an old key to authenticate, before
  that key gets deleted
  - was at least 5 minutes
  - now at least 2 minutes
  - at least (EXPIRE_KEYS_TIMEOUT_SECONDS - NEW_KEY_TIMEOUT_SECONDS)

Based on a merge request by Philip Withnall.

Fixes: #2164
Thanks: Philip Withnall
Thanks: Thiago Macieira
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-07 11:29:06 +01:00
Anders Jonsson
8a3f570e6f Update Swedish translation 2020-09-06 15:09:33 +00:00
Dušan Kazik
91027d4b35 Update Slovak translation 2020-09-06 11:27:49 +00:00
Goran Vidović
8be23b0017 Update Croatian translation 2020-09-05 21:56:16 +00:00
Марко Костић
602edf1b3c Update Serbian translation 2020-09-04 07:13:11 +00:00
Sebastian Dröge
83681d6216 Merge branch '2200-po-makefile-tabs' into 'master'
po: Fix tab indentation in Makefile.in.in

Closes #2200

See merge request GNOME/glib!1640
2020-09-03 09:48:03 +00:00