Commit Graph

20856 Commits

Author SHA1 Message Date
Ondrej Holy
b1aa9cd1ae gunixmounts: Prevent race when mtab file changed
mtab_file_changed_id might be set on thread default context, but it is
always cleared on the global context because of usage of g_idle_add. This
can cause the emission of redundant "mounts-change" signals. This should
not cause any issues to the client application, but let's attach the idle
source to the thread-default context instead to avoid those races for sure.
2020-02-18 10:18:59 +00:00
Ondrej Holy
1cd2ae372c gunixmounts: Prevent invalid time_read timestamps
The `get_mounts_timestamp()` function uses `mount_poller_time` when
`proc_mounts_watch_source` is set, but the `mount_poller_time` is not
initialized in the same time as `proc_mounts_watch_source`. This may
cause that zero, or some outdated value is returned. Let's initialize
`mount_poller_time` to prevent invalid values to be returned.
2020-02-18 10:18:59 +00:00
Ondrej Holy
cb1da9dc0a gunixmounts: Make GUnixMountMonitor thread-safe
The Nautilus test suite often crashes with "GLib-FATAL-CRITICAL:
g_source_is_destroyed: assertion 'g_atomic_int_get (&source->ref_count)
> 0' failed" if it is started with "GIO_USE_VOLUME_MONITOR=unix". This
is because GUnixMountMonitor is simultaneously used from multiple
threads over GLocalFile and GVolumeMonitor APIs. Let's add guards for
proc_mounts_watch_source and mount_poller_time variables to prevent
those crashes.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2030
2020-02-18 10:18:59 +00:00
Philip Withnall
6e8b8b0f8c Merge branch 'backport-1369-relative-paths-glib-2-62' into 'glib-2-62'
Backport !1369 “build: Rework path construction to reliably add prefix” to glib-2-62

See merge request GNOME/glib!1370
2020-02-17 19:53:40 +00:00
Sebastian Dröge
5fab0663ca Merge branch 'backport-1314-tz-parsing-glib-2-62' into 'glib-2-62'
Backport !1314 “gtimezone: fix parsing of Julian day in POSIX TZ format” to glib-2-62

See merge request GNOME/glib!1323
2020-02-17 19:03:41 +00:00
Sebastian Dröge
807dbde8a2 Merge branch 'backport-1330-st-ino-win32-glib-2-62' into 'glib-2-62'
Backport !1330 “W32: Correctly set st_ino when doing private stat()” to glib-2-62

See merge request GNOME/glib!1331
2020-02-17 19:01:59 +00:00
Philip Withnall
88cb9fe514 libcharset: Drop a redundant environment variable
It was used for running tests when we built with autotools, but is no
longer used in the Meson build system. If we need something similar in
future, it should be done by adding internal API to override the
directory on a per-call basis, rather than loading a path from a shared
global table every time.

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

Helps: #1919
2020-02-17 18:46:09 +00:00
Philip Withnall
9f0fc744c6 build: Rework path construction to reliably add prefix
There were a couple of custom paths which could end up being relative,
rather than absolute, due to not properly prefixing them with
`get_option('prefix')`.

The use of `join_paths()` here correctly drops all path components
before the final absolute path in the list of arguments. So if someone
configures GLib with an absolute path for `gio_module_dir`, that will be
used unprefixed; but if someone configures with a relative path, it will
be prefixed by `get_option('prefix)`.

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

Fixes: #1919
2020-02-17 18:46:09 +00:00
Philip Withnall
9f4af27412 Merge branch 'cherry-pick-2722620e' into 'glib-2-62'
Refactor g_socket_client_connect_async()

See merge request GNOME/glib!1365
2020-02-16 09:22:07 +00:00
Patrick Griffis
08677ed524 Refactor g_socket_client_connect_async()
This is a fairly large refactoring. The highlights are:

- Removing in-progress connections/addresses from GSocketClientAsyncConnectData:

  This caused issues where multiple ConnectionAttempt's would step over eachother
  and modify shared state causing bugs like accidentally bypassing a set proxy.

  Fixes #1871
  Fixes #1989
  Fixes #1902

- Cancelling address enumeration on error/completion

- Queuing successful TCP connections and doing application layer work serially:

  This is more in the spirit of Happy Eyeballs but it also greatly simplifies
  the flow of connection handling so fewer tasks are happening in parallel
  when they don't need to be.

  The behavior also should more closely match that of g_socket_client_connect().

- Better track the state of address enumeration:

  Previously we were over eager to treat enumeration finishing as an error.

  Fixes #1872
  See also #1982

- Add more detailed documentation and logging.

Closes #1995


(cherry picked from commit 2722620e32)
2020-02-16 08:57:30 +00:00
Simon McVittie
5a6f694184 tests: Cope with having CAP_DAC_OVERRIDE, even if not euid 0
Some CI platforms invoke these tests with euid != 0 but with
capabilities. Detect whether we have Linux CAP_DAC_OVERRIDE or other
OSs' equivalents, and skip tests that rely on DAC permissions being
denied if we do have that privilege.

(Cherry pick to 2.62: Fix one minor cherry-pick conflict.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2027
Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2028
2020-02-16 08:57:30 +00:00
Simon McVittie
58401555d8 tests: Don't assume that unprivileged uids are bound by RLIMIT_NPROC
Some CI platforms invoke tests as euid != 0, but with capabilities that
include CAP_SYS_RESOURCE and/or CAP_SYS_ADMIN. If we detect this,
we can't test what happens if our RLIMIT_NPROC is too low to create a
thread, because RLIMIT_NPROC is bypassed in these cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2029
2020-02-16 08:57:30 +00:00
Sebastian Dröge
088cfde0ed Merge branch 'backport-1353-source-refs-glib-2-62' into 'glib-2-62'
Backport !1353 GMainContext source reference fixes to glib-2-62

See merge request GNOME/glib!1361
2020-02-12 16:59:49 +00:00
Sebastian Dröge
3c517fb0f7 GMainContext - Add tests for !1353 and related situations 2020-02-12 15:35:18 +00:00
Sebastian Dröge
8258bbfee1 GMainContext - Move mutex unlocking in destructor right before freeing the mutex
This does not have any behaviour changes but is cleaner. The mutex is
only unlocked now after all operations on the context are done and right
before freeing the mutex and the context itself.
2020-02-12 15:33:25 +00:00
Sebastian Dröge
c278612318 GMainContext - Fix memory leaks and memory corruption when freeing sources while freeing a context
Instead of destroying sources directly while freeing the context, and
potentially freeing them if this was the last reference to them, collect
new references of all sources in a separate list before and at the same
time invalidate their context so that they can't access it anymore. Only
once all sources have their context invalidated, destroy them while
still keeping a reference to them. Once all sources are destroyed we get
rid of the additional references and free them if nothing else keeps a
reference to them anymore.

This fixes a regression introduced by 26056558be in 2012.

The previous code that invalidated the context of each source and then
destroyed it before going to the next source without keeping an
additional reference caused memory leaks or memory corruption depending
on the order of the sources in the sources lists.

If a source was destroyed it might happen that this was the last
reference to this source, and it would then be freed. This would cause
the finalize function to be called, which might destroy and unref
another source and potentially free it. This other source would then
either
- go through the normal free logic and change the intern linked list
  between the sources, while other sources that are unreffed as part of
  the main context freeing would not. As such the list would be in an
  inconsistent state and we might dereference freed memory.
- go through the normal destroy and free logic but because the context
  pointer was already invalidated it would simply mark the source as
  destroyed without actually removing it from the context. This would
  then cause a memory leak because the reference owned by the context is
  not freed.

Fixes https://github.com/gtk-rs/glib/issues/583 while still keeping
https://bugzilla.gnome.org/show_bug.cgi?id=661767 fixes.
2020-02-12 15:33:25 +00:00
Sebastian Dröge
14ddde471f GMainContext - Fix GSource iterator if iteration can modify the list
We first have to ref the next source and then unref the previous one.
This might be the last reference to the previous source, and freeing the
previous source might unref and free the next one which would then leave
use with a dangling pointer here.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/2031
2020-02-12 15:33:25 +00:00
Christian Kirbach
ec0983438a Update German translation 2020-02-09 14:01:58 +00:00
Sebastian Dröge
050f3a9a17 Merge branch 'backport-1351-suppression-fix-glib-2-62' into 'glib-2-62'
Backport !1351 “glib.supp: update g-threaded-resolver-getaddrinfo-config” to glib-2-62

See merge request GNOME/glib!1352
2020-02-06 11:02:53 +00:00
Guillaume Desmottes
b66c6f42b1 glib.supp: update g-threaded-resolver-getaddrinfo-config
This leak is now detected as 'definite' in newer version of Fedora,
see https://gitlab.freedesktop.org/gstreamer/gst-ci/merge_requests/226
2020-02-03 08:37:17 +00:00
Milo Casagrande
991e90e423 Update Italian translation 2020-01-31 12:24:52 +00:00
Руслан Ижбулатов
ff3c3be47d W32: Correctly set st_ino when doing private stat() 2020-01-20 10:54:17 +00:00
Daniel P. Berrange
4a72440efb gtimezone: fix parsing of Julian day in POSIX TZ format
The timezone(3) man page on Fedora 31 describes the start/end
field in the POSIX TZ format as follows:

[quote]
   The start field specifies when daylight  saving  time  goes
   into  effect and the end field specifies when the change is
   made back to standard time.  These fields may have the fol‐
   lowing formats:

   Jn     This  specifies  the Julian day with n between 1 and
          365.  Leap days are not counted.   In  this  format,
          February 29 can't be represented; February 28 is day
          59, and March 1 is always day 60.

   n      This specifies the  zero-based  Julian  day  with  n
          between  0  and 365.  February 29 is counted in leap
          years.

   Mm.w.d This specifies day d (0 <= d <= 6) of week w (1 <= w
          <=  5)  of  month  m  (1 <= m <= 12).  Week 1 is the
          first week in which day d occurs and week 5  is  the
          last week in which day d occurs.  Day 0 is a Sunday.
[/quote]

The GTimeZone code does not correctly parse the 'n' syntax,
treating it as having the range 1-365, the same as the 'Jn'
syntax. This is semantically broken as it makes it impossible
to represent the 366th day, which is the purpose of the 'n'
syntax.

There is a code comment saying this was done because the Linux
semantics are different from zOS and BSD. This is not correct,
as GLibC does indeed use the same 0-365 range as other operating
systems. It is believed that the original author was mislead by
a bug in old versions of the Linux libc timezone(3) man pages
which was fixed in

  commit 5a554f8e525faa98354c1b95bfe4aca7125a3657
  Author: Peter Schiffer <pschiffe@redhat.com>
  Date:   Sat Mar 24 16:08:10 2012 +1300

    tzset.3: Correct description for Julian 'n' date format

    The Julian 'n' date format counts atrting from 0, not 1.

    Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

Fixes: #1999

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2020-01-15 18:50:25 +00:00
Daniel P. Berrange
0439b0b648 gtimezone: fix inverted ignore_leap param parsing julian day
The callers of parse_tz_boundary inverted the value passed
for the ignore_leap parameter. Fortunately the method impl
also had an inverted test cancelling out the first bug.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2020-01-15 18:50:25 +00:00
Philip Withnall
df7e4bbda0 subprojects: Temporarily avoid using wrapdb while it’s down
This should fix our CI, which is currently failing on any system which
requires using the zlib subproject (typically VS systems) as wrapdb is
down. Work around that by pointing our wrap file at the underlying
github hosting instead.

See https://github.com/mesonbuild/meson/issues/6446#issuecomment-574241715

This can be reverted when wrapdb is working again.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-15 18:50:25 +00:00
Umarzuki Bin Mochlis Moktar
52c68388f5 Update Malay translation 2020-01-08 15:02:53 +00:00
Kukuh Syafaat
2db2658b71 Update Indonesian translation 2020-01-02 00:46:15 +00:00
Balázs Úr
26ba8242dc Update Hungarian translation 2019-12-30 18:13:23 +00:00
Daniel Mustieles
9f67778695 Updated Spanish translation 2019-12-30 12:47:44 +01:00
Aurimas Černius
27551709e5 Updated Lithuanian translation 2019-12-28 17:38:22 +02:00
Rafael Fontenelle
e1899a4196 Update Brazilian Portuguese translation 2019-12-24 10:13:18 +00:00
Anders Jonsson
8b0e553384 Update Swedish translation 2019-12-22 10:52:20 +00:00
Piotr Drąg
36d0d02c81 Update Polish translation 2019-12-19 18:04:58 +01:00
Philip Withnall
dac69d7128 2.62.4
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.62.4
2019-12-19 16:30:37 +00:00
Simon McVittie
194e596cff Merge branch 'backport-1201-gdbus-recursion-glib-2-62' into 'glib-2-62'
Backport !1201 “gdbusmessage: Limit recursion of variants in D-Bus messages” to glib-2-62

See merge request GNOME/glib!1290
2019-12-19 15:56:28 +00:00
Philip Withnall
b4086e0fb7 gdbusmessage: Limit recursion of variants in D-Bus messages
This is the analogue of commit 7c4e6e9fbe, but applied to the
`GDBusMessage` parser, which does its own top-level parsing of the
variant format in D-Bus messages.

Previously, this code allowed arbitrary recursion of variant containers,
which could lead to a stack overflow. Now, that recursion is limited to
64 levels, as per the D-Bus specification:

https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-signature

This includes a new unit test.

oss-fuzz#14870

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-16 20:05:09 +00:00
Philip Withnall
8f3412b360 tests: Tidy up test case naming in gdbus-serialization test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-16 20:05:09 +00:00
Philip Withnall
391bff5a7a gdbusmessage: Move variable initialisation to declaration time
Tidies up the code a bit, but introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-16 20:05:09 +00:00
Emmanuele Bassi
f1acda4dda Merge branch 'backport-1233-iso8601-leap-seconds-glib-2-62' into 'glib-2-62'
Backport !1233 “gdatetime: Handle leap seconds in ISO8601 dates” to glib-2-62

See merge request GNOME/glib!1240
2019-12-16 13:33:31 +00:00
Emmanuele Bassi
b22e5e7323 Merge branch 'backport-1232-kevent-errors-glib-2-62' into 'glib-2-62'
Backport !1232 “kqueue: Do not return early from _kqsub_cancel” to glib-2-62

See merge request GNOME/glib!1257
2019-12-12 13:51:59 +00:00
Philip Withnall
505e7d6d12 Merge branch 'backport-1274-trash-symlinks-glib-2-62' into 'glib-2-62'
Backport !1274 “trash portal: Don't follow symlinks” to glib-2-62

See merge request GNOME/glib!1276
2019-12-11 13:22:17 +00:00
Matthias Clasen
463ccbd587 trash portal: Don't follow symlinks
We got a complaint here that trashing via the
portal deletes the target of a symlink, not the
symlink itself. It turns out that following the
symlink already happens on the glib side.

https://github.com/flatpak/xdg-desktop-portal/issues/412
2019-12-11 10:53:49 +00:00
Sebastian Dröge
facc3a7527 Merge branch 'backport-1265-visibility-checks-glib-2-62' into 'glib-2-62'
Backport !1265 “build: don't check for protected visibility” to glib-2-62

See merge request GNOME/glib!1266
2019-12-03 12:38:39 +00:00
Matthew Waters
9430082bbf build: don't check for protected visibility
It's not supported on macOS' clang compiler and will fail the visibility
check and thus make the G_GNUC_INTERNAL attribute do nothing.

Compiler stderr:
 /var/folders/nt/j2v2x4wd5cl33fq27mm31mwc0000gn/T/tmpxxf2zzi_/testfile.c:13:19: error: target does not support 'protected' visibility; using 'default' [-Werror,-Wunsupported-visibility]
  __attribute__ ((visibility ("protected")))
                  ^
1 error generated.

Checking if "GNU C visibility attributes test" compiles: NO
2019-12-03 11:49:24 +00:00
Ting-Wei Lan
38815ffa55 kqueue: Do not return early from _kqsub_cancel
_kqsub_free assumes the caller has called _kqsub_cancel before calling
it. It checks if both 'deps' and 'fd' have been freed and aborts when
the condition is not met. Since the only caller of _kqsub_free is
g_kqueue_file_monitor_finalize, which does call _kqsub_cancel before
calling _kqsub_free, it seems to be correct for _kqsub_free to assert
values of these two members there.

However, it is possible for _kqsub_cancel to return early without
freeing any resource _kqsub_free expects to be freed. When the kevent
call fails, _kqsub_cancel does not free anything and _kqsub_free aborts
with assertion failure. This is an unexpected behavior, and it can be
fixed by always freeing resources in _kqsub_cancel.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1935
2019-11-28 09:29:47 +00:00
Bastien Nocera
9ba4060ce2 gdatetime: Handle leap seconds in ISO8601 dates
GDateTime doesn't handle leap seconds, so just round these down to
the previous second.

(Cherry-pick had minor conflicts in the documentation.)

https://gitlab.gnome.org/GNOME/glib/issues/1938
2019-11-21 09:58:35 +00:00
Philip Withnall
bda1ad5918 2.62.3
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.62.3
2019-11-19 17:51:14 +00:00
Emmanuele Bassi
521135c61c Merge branch 'backport-1218-hashtable-printer-glib-2-62' into 'glib-2-62'
Backport !1218 “gdb: Fix GHashTable pretty printer off-by-one error”

See merge request GNOME/glib!1219
2019-11-18 12:47:36 +00:00
Emmanuele Bassi
c90b60f1db Merge branch 'backport-1221-note-revoke-kqueue-glib-2-62' into 'glib-2-62'
Backport !1221 “Add NOTE_REVOKE to the list of the monitoring events” to glib-2-62

See merge request GNOME/glib!1222
2019-11-18 12:47:29 +00:00
Emmanuele Bassi
16cbdef50a Merge branch 'backport-1199-utf8-ub-glib-2-62' into 'glib-2-62'
Backport !1199 “gunicode: Fix UB in gutf8.c and utf8-pointer test” to glib-2-62

See merge request GNOME/glib!1228
2019-11-18 12:43:44 +00:00