Commit Graph

19981 Commits

Author SHA1 Message Date
Dz Chen
2ac344c5b4 Update Chinese (China) translation 2022-09-11 19:19:25 +00:00
Ting-Wei Lan
d2323836cc Update Chinese (Taiwan) translation 2019-10-08 10:47:24 +00:00
Philip Withnall
a7da87e3e8 2.60.7
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.60.7
2019-09-02 14:25:55 +01:00
Emmanuele Bassi
2305afbeaa Merge branch 'backport-1009-application-crash-glib-2-60' into 'glib-2-60'
Backport !1009 “gapplication: remove inactivity_timeout source on finalize” to glib-2-60

See merge request GNOME/glib!1012
2019-09-02 13:22:31 +00:00
Emmanuele Bassi
f998e714a7 Merge branch 'backport-1017-iso8601-parsing-glib-2-60' into 'glib-2-60'
Backport !1017 “gdatetime: Avoid an assertion failure when parsing some ISO 8601 dates” to glib-2-60

See merge request GNOME/glib!1081
2019-09-02 13:21:22 +00:00
Philip Withnall
2ce0d7ab7c gdatetime: Avoid an assertion failure when parsing some ISO 8601 dates
Some malformed ISO 8601 date/time strings were causing an assertion
failure when passed to `g_date_time_new_from_iso8601()`, due to a
mismatch between the bounds checking of timezone offsets in `GDateTime`
and `GTimeZone`. Fix that and add a unit test for it.

(Trivial backport of !1017.)

oss-fuzz#16101

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-02 13:40:18 +01:00
Sebastian Dröge
33905dd995 Merge branch 'backport-1040-settings-backend-race-glib-2-60' into 'glib-2-60'
Backport !1040 “GSettingsBackend - Fix thread-safety during destruction of GSettings instances...” to glib-2-60

See merge request GNOME/glib!1065
2019-08-27 11:29:38 +00:00
Sebastian Dröge
88fd610a9e GSettingsBackend - Fix thread-safety during destruction of GSettings instances while notifications are emitted
g_settings_backend_watch() uses a weak notify for keeping track of
the target. There's an explanation why this is supposed to be safe but
that explanation is wrong.

The following could happen before:

1. We have the target stored in the watch list
2. The last reference to the target is dropped in thread A and we end up
   in g_settings_backend_watch_weak_notify() right before the mutex
3. g_settings_backend_dispatch_signal() is called from another thread B
   and gets the mutex before 2.
4. g_weak_ref_init() is called on the target from thread B, which at
   this point has a reference count of exactly one (see g_object_unref()
   where it calls the weak notifies)
5. Thread A continues at 3. and drops the last reference and destroys
   the object. Now the GWeakRef from 4. points to a destroyed object. Note
   that GWeakRefs would be cleared before the weak notifies are called
6. At some later point another thread g_weak_ref_get() is called by
   g_settings_backend_invoke_closure() and accesses an already destroyed
   object with refcount 0 from the GWeakRef created in 4. by thread B (or
   worse, already freed memory that was reused).

Solve this by actually storing a GWeakRef of the target in the watch
list and only access the target behind it via the GWeakRef API, and then
pass a strong reference to the notification dispatch code.

The weak notify is only used to remove the (potentially with empty
GWeakRef) target from the list of watches and the only place that
compares the target by pointer instead of going through the GWeakRef
API.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1870
2019-08-27 13:40:10 +03:00
Nirbheek Chauhan
6a9d6c2715 Merge branch 'backport-966-win32-uri-crash-fix' into 'glib-2-60'
Backport !966 “Resolve "Invalid characters in Open Location dialog crashes GIMP"” to glib-2-60

See merge request GNOME/glib!1061
2019-08-27 07:28:22 +00:00
Philip Withnall
87c8168980 gwinhttpvfs: Fall back to wrapped VFS if creating a HTTP file fails
If we fail to create a GWinhttpFile for a URI (for example, because it’s
an invalid URI or is badly encoded), don’t just return NULL. Instead,
fall back to the wrapped VFS which might be able to handle it instead.

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

Fixes: #1819
2019-08-27 08:24:16 +03:00
Philip Withnall
7b90d507d8 gwinhttpfile: Document constructor as potentially returning NULL
It can return NULL if the URI was badly encoded or couldn’t be handled
by Windows’ API.

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

Helps: #1819
2019-08-27 08:24:15 +03:00
Philip Withnall
9dac535c8c gvfs: Add an assertion to check that get_file_for_uri() is never NULL
It cannot return a NULL value, as none of its callers have error
handlng. Add an assertion to check the values returned by the VFS
implementations.

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

Helps: #1819
2019-08-27 08:24:15 +03:00
Emmanuele Bassi
a365528f64 Merge branch 'backport-1008-structured-logging-glib-2-60' into 'glib-2-60'
Backport !1008 “gmessages: Only use structured logs if GLIB_VERSION_MAX_ALLOWED is ≥2.56” to glib-2-60

See merge request GNOME/glib!1013
2019-08-05 16:28:07 +00:00
Ting-Wei Lan
c5e3150443 gapplication: remove inactivity_timeout source on finalize
The event source used to handle inactivity_timeout doesn't hold a
reference on the application. Therefore, it is possible for callback
function of the event source to run after the application has been
freed, leading to use-after-free problem. To avoid the problem, we
should remove the event source before the application is freed.

This should fix SIGBUS crash of gio/tests/gapplication on FreeBSD.
https://gitlab.gnome.org/GNOME/glib/issues/1846#note_566550
2019-07-29 11:02:31 +01:00
Philip Withnall
0519199cce gmessages: Only use structured logs if GLIB_VERSION_MAX_ALLOWED is ≥2.56
Only redefine g_message() and friends to use structured logging if the
compiling code is OK with depending on GLib functionality from ≥2.56.

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

Fixes: #1847
2019-07-29 11:01:58 +01:00
Philip Withnall
0a63daa964 2.60.6
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.60.6
2019-07-24 11:51:45 +01:00
Matthias Clasen
0c149089ca Merge branch 'backport-984-985-keyfile-portal-fixes-glib-2-60' into 'glib-2-60'
Backport !984, !985 keyfile/portal fixes to glib-2-60

See merge request GNOME/glib!993
2019-07-15 14:15:37 +00:00
Matthias Clasen
715c8670ae key file: Handle filename being NULL
This happens when we are default-constructed
without explicit arguments.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1825
2019-07-15 13:55:14 +01:00
Matthias Clasen
0ef6ccab35 settings: Tweak priorities for keyfile backend
We want to use the keyfile backend in sandboxes,
but we want to avoid people losing their existing
settings that are stored in dconf. Flatpak does
a migration from dconf to keyfile, but only if
the app explictly requests it.

From an app perspective, there are two steps to
the dconf->keyfile migration:
1. Request that flatpak do the migration, by adding
   the migrate-path key to the metadata
2. Stop adding the 'dconf hole' to the sandbox

To keep us from switching to the keyfile backend
prematurely, look at whether the app has stopped
requesting a 'dconf hole' in the sandbox.
2019-07-15 13:48:47 +01:00
Matthias Clasen
69dcbc83d8 portal: Add a getter for dconf access
Add method to find whether the sandbox provides
access to dconf. This will be used to tweak
the priorities for the keyfile settings backend.
2019-07-15 13:48:47 +01:00
Philip Withnall
cffe8efd0a 2.60.5
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.60.5
2019-07-09 11:56:55 +01:00
Emmanuele Bassi
6c3a821d39 Merge branch 'backport-958-gcond-errno-glib-2-60' into 'glib-2-60'
gthread: fix minor errno problem in GCond

See merge request GNOME/glib!965
2019-07-09 10:43:57 +00:00
Emmanuele Bassi
de4d107744 Merge branch 'backport-945-markup-stack-overrun-glib-2-60' into 'glib-2-60'
Backport !945 “Avoid overrunning stack at the end of the varargs.” to glib-2-60

See merge request GNOME/glib!949
2019-07-09 10:42:08 +00:00
Emmanuele Bassi
1431ff0717 Merge branch 'backport-954-unicode-mani-glib-2-60' into 'glib-2-60'
Backport !954 “Fix the ISO 15924 code for Manichaean” to glib-2-60

See merge request GNOME/glib!956
2019-07-09 10:41:31 +00:00
Emmanuele Bassi
74a6c12742 Merge branch 'backport-974-keyfile-settings-type-glib-2-60' into 'glib-2-60'
Backport !974 “Ensure that the keyfile settings backend exists” to glib-2-60

See merge request GNOME/glib!977
2019-07-09 10:39:51 +00:00
Matthias Clasen
cba4a0d2df Ensure that the keyfile settings backend exists
We need to bring the type into existence.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1822
2019-07-09 09:50:11 +01:00
Emmanuele Bassi
e43a63726d Merge branch 'backport-968-openuriportal-typo-glib-2-60' into 'glib-2-60'
Backport !968 ”Fix typo in request handle” to glib-2-60

See merge request GNOME/glib!969
2019-07-04 16:58:40 +00:00
David Strauss
dcfb232b3e Fix typo in request handle 2019-07-04 17:24:41 +01:00
Allison Karlitskaya
e4c9a62173 gthread: fix minor errno problem in GCond
The return value from `g_cond_wait_until()` is calculated, based on the
value of `errno` after reacquiring the mutex.  This is a problem because
`errno` can be overwritten in the case the mutex is contended (in which
case the slow-path code will re-enter the kernel).

Perform the calculation before reacquiring the mutex.

See merge request GNOME/glib!958
2019-07-02 11:48:01 +01:00
David Corbett
4fe42771ec Fix the ISO 15924 code for Manichaean 2019-06-27 11:14:40 +01:00
John Ralls
353942c67e Avoid overrunning stack at the end of the varargs. 2019-06-24 14:28:54 +01:00
Philip Withnall
23a6173e4e Merge branch 'dbus-security-glib-2-60' into 'glib-2-60'
Backport !909 “D-Bus auth mechanism improvements” to glib-2-60

See merge request GNOME/glib!910
2019-06-11 10:21:46 +00:00
Simon McVittie
85c1ec0827 gdbusdaemon: Only authorize anonymous users on Windows, not Unix
On Unix, we expect EXTERNAL authentication to work.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Simon McVittie
d2ae55fafa gdbus-example-peer: Provide an example GDBusAuthObserver
It's somewhat unrealistic to use a GDBusServer without a
GDBusAuthObserver, because most D-Bus servers want to be like the
standard session bus (the owning user can connect) rather than being
like the standard system bus (all users can connect, the server is a
security boundary, and many bugs are security vulnerabilities).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Simon McVittie
27e4e387cc GDBusAuthObserver: Document how to restrict authentication to EXTERNAL
This is simpler and more robust than DBUS_COOKIE_SHA1, which relies
on assumptions about random numbers and a secure home directory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Simon McVittie
6964a2a255 GDBusAuthObserver: Fix mixup between authentication and authorization
Authentication is about proving who I am; authorization is about
whether, given the knowledge of who I am, I am allowed to do something.
GDBusServer and GDBusConnection carry out authentication automatically,
but rely on the library user to carry out authorization.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Simon McVittie
1031e466cf GDBusServer: Document that a GDBusAuthObserver is usually desirable
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Simon McVittie
b6988b685f Document where we expect credentials-passing to be supported
This is useful information for implementors of portable software to know
whether they can rely on credentials-passing.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:47 +01:00
Philip Withnall
6672d0cbed 2.60.4
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.60.4
2019-06-10 18:37:19 +01:00
Emmanuele Bassi
e25de8e5d5 Merge branch 'backport-904-genmarshal-fixes-glib-2-60' into 'glib-2-60'
Backport !904 “Fix some valist genmarshal bugs” to glib-2-60

See merge request GNOME/glib!905
2019-06-10 17:03:42 +00:00
Sebastian Dröge
acdccff4d2 Merge branch 'backport-799-func-macro-glib-2-60' into 'glib-2-60'
Backport !799 “Revert "macros: Try to use the standard __func__ first in G_STRFUNC"” to glib-2-60

See merge request GNOME/glib!899
2019-06-10 12:15:55 +00:00
Philip Withnall
804ce8b703 glib-genmarshal: Avoid a string copy for static string valist arguments
When building a valist marshaller, we can avoid a string copy if the
argument is known to always be static. The marshaller we ship in
`gmarshal.c` got this right, but marshallers generated by
glib-genmarshal were missing the optimisation. Fix that.

Backported version of !904 does not include the unit test. The version
of this on `master` includes a unit test.

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

Fixes: #1792
2019-06-08 00:30:24 +01:00
Philip Withnall
f843ba8c44 glib-genmarshal: Fix ref-sinking of GVariants in valist marshallers
The old (Perl) implementation of glib-genmarshal used
g_variant_ref_sink() to correctly handle floating inputs; the Python
version should do the same.

Backported version of !904 does not include the unit test. The version
of this on `master` includes a unit test.

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

Fixes: #1793
2019-06-08 00:30:20 +01:00
Philip Withnall
7f7f7e3cc3 Revert "macros: Try to use the standard __func__ first in G_STRFUNC"
This reverts commit 9f75cc9edf.

It breaks usage of G_STRFUNC when compiling applications with
`-Wpedantic` — `__func__` is not `#define`d, so G_STRFUNC was falling
through to using `__FUNCTION__`, which raises a warning with
`-Wpedantic`.

Fun times.

Fixes: #1755
2019-06-07 11:14:07 +01:00
Philip Withnall
dbd8193a87 Merge branch 'backport-865-happier-eyeballs-glib-2-60' into 'glib-2-60'
Backport !865 'gnetworkaddress: fix "happy eyeballs" logic' to glib-2-60

See merge request GNOME/glib!894
2019-06-05 09:45:40 +00:00
Allison Karlitskaya
24c2760c8f network-address test: add ipv6-fail ipv4-slow case
Add a case for when the IPv6 result comes back negative and the IPv4
result is significantly delayed.  This is exactly the case that causes
the bug addressed by GNOME/glib!865
2019-06-05 09:34:37 +02:00
Allison Karlitskaya
2b6a3c110d gnetworkaddress: fix "happy eyeballs" logic
The "happy eyeballs" RFC states that on receiving a negative response
for an IPv6 address lookup, we should wait for the IPv4 lookup to
complete and use any results we get from there.

The current code was not doing that: it was rather setting a timeout for
failing the resolution entirely.  In scenarios where the IPv4 response
comes more than 50ms after the IPv6 response (which is easily attainable
under valgrind in certain configurations) this means that the IPv4
response will never come.

Remove the timeout and just wait.

See merge request GNOME/glib!865
2019-06-04 23:01:37 +02:00
Philip Withnall
39cbb84e36 Merge branch 'backport-876-gfile-permissions-glib-2-60' into 'glib-2-60'
Backport !876 “gfile: Limit access to files when copying” to glib-2-60

See merge request GNOME/glib!878
2019-06-04 10:09:16 +00:00
Ondrej Holy
e6b769819d gfile: Limit access to files when copying
file_copy_fallback creates new files with default permissions and
set the correct permissions after the operation is finished. This
might cause that the files can be accessible by more users during
the operation than expected. Use G_FILE_CREATE_PRIVATE for the new
files to limit access to those files.
2019-06-04 10:58:20 +01:00
Christoph Reiter
e4ae836d40 Merge branch 'backport-875-ci-win32-glib-2-60' into 'glib-2-60'
Backport !875 “CI/msys2: disable coverage reporting, lcov doesn't support gcc9 yet” to glib-2-60

See merge request GNOME/glib!886
2019-06-04 05:48:40 +00:00