Commit Graph

21285 Commits

Author SHA1 Message Date
wouter bolsterlee
809a9210c3 Support multiple directories in GSETTINGS_SCHEMA_DIR
This adds support for specifying multiple directories in the
GSETTINGS_SCHEMA_DIR environment variable by separating the values
using G_SEARCHPATH_SEPARATOR_S (colon on UNIX-like systems).

While programs could already register multiple custom GSettings schema
directories, it was not possible to achieve the same without writing
custom code, e.g. when using the gsettings command line tool.

Fixes #1998.
2020-01-16 10:20:34 +00:00
Philip Withnall
321fea1c5e Merge branch 'wip/muktupavels/notifications' into 'master'
gfdonotificationbackend: remove notifications when bus name vanishes

See merge request GNOME/glib!1317
2020-01-16 06:52:16 +00:00
Philip Withnall
c0a019c293 Merge branch 'threadpool-inherit-prio' into 'master'
GThreadPool - Don't inherit thread priorities when creating new threads

Closes #1834

See merge request GNOME/glib!1113
2020-01-15 21:56:26 +00:00
Sebastian Dröge
8aeca4fa64 GThreadPool - Don't inherit thread priorities when creating new threads
By default (on POSIX) we would be inheriting thread priorities from the
thread that pushed a new task on non-exclusive thread pools and causes a
new thread to be created. This can cause any non-exclusive thread pool
to accidentally contain threads of different priorities, or e.g. threads
with real-time priority.

To prevent this, custom handling for setting the scheduler settings for
Linux and Windows is added and as a fallback for other platforms a new
thread is added that is responsible for spawning threads for
non-exclusive thread pools.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1834
2020-01-15 23:18:33 +02:00
Philip Withnall
8e82d549ee Merge branch 'gutils-crash' into 'master'
Fix crash in gutils when application is prevented access to passwd file

See merge request GNOME/glib!1309
2020-01-15 18:14:00 +00:00
Philip Withnall
93784fb4c2 Merge branch 'codegen-allow-interactive-auth' into 'master'
gdbus-codegen: Add a GDBusCallFlags arg to method calls

See merge request GNOME/glib!1286
2020-01-15 18:01:52 +00:00
Philip Withnall
a711d59a2f Merge branch 'tz' into 'master'
gtimezone: fix parsing of Julian day in POSIX TZ format

Closes #1999

See merge request GNOME/glib!1314
2020-01-15 17:57:16 +00:00
Matthew Leeds
2a605f6e15 gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).

If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).

So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.

The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46

It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.

Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.

Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.

The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.

Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2020-01-15 09:37:41 -08:00
Alberts Muktupāvels
5d791352f2 gfdonotificationbackend: remove notifications when bus name vanishes
Notification id (notify_id) is generated by notification daemon and
is valid only while daemon is running. If notification backend will
resend/reuse existing notification id (replace_id) after notification
daemon has been restarted it could replace wrong notification as same
id now can be used by different notification.
2020-01-15 16:38:52 +02:00
Sebastian Dröge
6f34e84002 Merge branch 'thread-win32-inherit-prio' into 'master'
GThread - Inherit parent thread priority by default for new Win32 threads

See merge request GNOME/glib!1301
2020-01-15 14:19:36 +00:00
Emmanuele Bassi
7b24e21d51 Merge branch '1997-base64-wrapping-docs' into 'master'
gbase64: Fix documentation for line wrapping lengths

Closes #1997

See merge request GNOME/glib!1321
2020-01-15 14:12:25 +00:00
Daniel P. Berrange
3c0685ec4a 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 14:11:59 +00:00
Daniel P. Berrange
6cd263f655 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 14:11:59 +00:00
Sebastian Dröge
be537d8b51 GThread - Inherit parent thread priority by default for new Win32 threads
This is the default behaviour on POSIX and having different behaviour
between the two GThread implementations could lead to subtle problems.
2020-01-15 15:23:20 +02:00
Philip Withnall
8d3c502074 gbase64: Fix documentation for line wrapping lengths
The implementation has always wrapped at 76 characters, rather than 72,
ever since it was introduced in commit 5cf8f1d4a8 in 2006. At this
stage, it’s probably best to fix the documentation rather than the
implementation.

The likely bug in the implementation is the comparison
```
(++already) >= 19
```

19 × 4 = 76, so it seems like an off-by-one error in the comparison.
What was actually wanted was 18 × 4 = 72.

Thanks to Simon McVittie for the investigation and diagnosis.

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

Fixes: #1997
2020-01-15 13:15:54 +00:00
Jakub Jelen
d2107c17c8 Reproducer for the null pw_name returned from getpwuid()
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2020-01-15 14:07:20 +01:00
Jakub Jelen
17d6fc4e64 gutils: Avoid null dereference if getpwuid fails to acquire some information about user
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2020-01-15 14:07:20 +01:00
Emmanuele Bassi
9ed4b813e5 Merge branch 'wrapdb-workaround' into 'master'
subprojects: Temporarily avoid using wrapdb while it’s down

See merge request GNOME/glib!1320
2020-01-15 12:53:19 +00:00
Philip Withnall
cab577222f 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 10:53:47 +00:00
Xavier Claessens
547f5316e3 Merge branch '1416-macos-ci' into 'master'
ci: Add macOS CI runner

Closes #1416

See merge request GNOME/glib!1273
2020-01-14 21:09:48 +00:00
Michael Catanzaro
9765ce80c9 Merge branch 'mcatanzaro/rehandshake' into 'master'
Fully deprecate TLS rehandshakes

See merge request GNOME/glib!1305
2020-01-07 21:14:38 +00:00
Michael Catanzaro
bbbaae9fb7 Fully deprecate TLS rehandshakes
Previously, the documentation indicated that it was possible to call
g_tls_connection_handshake() after an initial handshake to trigger a
rehandshake, but only if TLS 1.2 or older is in use. However, there is
no documented way to ensure TLS 1.2 gets used. Nowadays, TLS 1.3 is used
by default.

I'm removing support for rehandshaking from glib-networking, as part of
a large refactoring where keeping rehandshakes would have entailed
significant additional complexity. So let's update the documentation to
indicate this is no longer ever supported. Applications should not
notice any difference.

Also, sync some previous handshake and rehandshake changes from
GTlsConnection to GDtlsConnection that were missed by mistake. I
try to remember to always update GDtlsConnection when touching
GTlsConnection documentation, but it's easy to forget.
2020-01-07 14:52:20 -06:00
Bastien Nocera
e706cc9cf2 Merge branch 'wip/hadess/fix-gmemory-monitor-example' into 'master'
GMemoryMonitor docs fixes

See merge request GNOME/glib!1294
2020-01-07 17:51:51 +00:00
Bastien Nocera
2394bc755a docs: Add full code example for GMemoryMonitor 2020-01-07 18:29:53 +01:00
Bastien Nocera
b04be9efc7 docs: Fix markup that led to unreadable example
We used XML to markup when we should have used our own brand of markdown
instead. This fixes the example being unreadable unless we trimmed the
XML away from it.
2020-01-07 18:29:53 +01:00
Philip Withnall
4151dfea82 Merge branch 'wip/hadess/test-fixes' into 'master'
gio: Fix socket test

See merge request GNOME/glib!1295
2020-01-07 16:21:20 +00:00
Philip Withnall
a7880d84d0 Merge branch 'wip/smcv/gvariant-memcpy0' into 'master'
gvariant-core: Don't pass NULL second argument to memcpy

See merge request GNOME/glib!1303
2020-01-07 16:16:35 +00:00
Philip Withnall
9761ecad75 Merge branch 'mcatanzaro/gsocketclient-improvement' into 'master'
gsocketclient: run timeout source on the task's main context

See merge request GNOME/glib!1308
2020-01-07 15:37:50 +00:00
Philip Withnall
076fd5a922 WIP: ci: Add macOS CI runner
We had one before, but the runner machine was too flaky to be useful.
Re-add it now that the Foundation have sorted out a more reliable
machine. (Thanks!)

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

Fixes: #1416
2020-01-07 10:32:46 -05:00
Bastien Nocera
e537716540 tests: Fix error path not setting an error
This failure path should have set the GError but did not.
2020-01-07 15:07:37 +00:00
Bastien Nocera
b3197f2740 tests: Fix incomplete failure check in socket test
For the check "if (error != NULL)" to work as expected, the
create_server() (and create_server_full()) functions need to make
sure to return an error for all the possible failures, but this
might not always be the case.

Catch all the failures by testing for a non-NULL return value if there
was no error.
2020-01-07 15:07:37 +00:00
Simon McVittie
e9337a9c1d gvariant-core: Don't pass NULL second argument to memcpy
Similar to 3837b83f, glibc memcpy is declared with the first two
arguments annotated as non-null via an attribute, which results in the
undefined behaviour sanitizer considering it to be UB to pass a null
pointer there (even if we are copying no bytes, and hence not actually
dereferencing the pointer).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-01-07 15:06:51 +00:00
Michael Catanzaro
cc3cf6b8b2 gsocketclient: run timeout source on the task's main context
This shouldn't make any difference, because this code should only ever
be running in the main context that was thread-default at the time the
task was created, so it should already match the task's context. But
let's make sure, just in case.
2020-01-07 15:05:22 +00:00
Simon McVittie
027c3f8d59 Merge branch '1983-fix-fake-document-portal' into 'master'
tests: Fix callback arguments in fake-document-portal

Closes #1983

See merge request GNOME/glib!1312
2020-01-07 14:38:05 +00:00
Philip Withnall
7d0a1c5c58 tests: Fix callback arguments in fake-document-portal
They didn’t match the prototype generated by `gdbus-codegen`, which
meant that the FD list was being iterated incorrectly. Secondly, the
document ID list returned by the method was not NULL terminated, which
could lead to reading off the end of the list.

Somehow, neither of these bugs caused problems on Linux, but they did
cause problems on FreeBSD.

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

Fixes: #1983
2020-01-07 11:20:45 +00:00
Michael Catanzaro
85c19a7977 Sync GDtlsConnection handshake docs with GTlsConnection
Sadly, I forgot to update the documentation of
g_dtls_connection_handshake() last time I touched
g_tls_connection_handshake().

Let's also drop mention of STARTTLS, since that would use normal TLS,
not DTLS.
2020-01-02 20:26:09 -06:00
Kukuh Syafaat
7ff3875591 Update Indonesian translation 2020-01-02 00:58:06 +00:00
Balázs Úr
3e2f443af1 Update Hungarian translation 2019-12-30 18:10:59 +00:00
Daniel Mustieles
8f3e553a06 Updated Spanish translation 2019-12-30 12:48:18 +01:00
Fran Dieguez
b9227e687e Update Galician translation 2019-12-25 03:05:56 +00:00
Rafael Fontenelle
cafb0e64d3 Update Brazilian Portuguese translation
(cherry picked from commit e1899a4196)
2019-12-24 10:13:58 +00:00
Nirbheek Chauhan
338203e04e Merge branch '198-fopen-docs' into 'master'
docs: Improve g_fopen description for Win32

Closes #198

See merge request GNOME/glib!1292
2019-12-23 10:07:08 +00:00
Piotr Drąg
135c04608c Update Polish translation 2019-12-19 18:05:39 +01:00
Philip Withnall
f4ff348546 Merge branch 'fix-prop-set-error' into 'master'
tests: Fix an error message set by foo_set_property()

See merge request GNOME/glib!1279
2019-12-18 16:39:56 +00:00
Matthew Leeds
a28c34ba88 tests: Fix an error message set by foo_set_property()
The property name and value were mistakenly swapped.
2019-12-18 16:39:56 +00:00
Philip Withnall
51c3921022 Merge branch 'appinfo-doc-portal-test' into 'master'
gio: test that launch_uris() exports files with the document portal when launching a flatpak

See merge request GNOME/glib!1111
2019-12-17 15:30:11 +00:00
Emmanuele Bassi
78fa941c86 Merge branch '833-gobject-set-docs' into 'master'
docs: Clarify handling of 64-bit integer literals with g_object_new()

Closes #833

See merge request GNOME/glib!1293
2019-12-17 13:16:29 +00:00
James Henstridge
e24db62363 gio: do not cache document portal D-Bus proxy
By removing the cached global proxy in gdocumentportal.c, we can
re-enable the checks for proper shutdown of the session bus connection
in the dbus-appinfo.c test.
2019-12-17 21:03:03 +08:00
James Henstridge
926ff8c6a7 gio/tests: add a test for document portal use when launching flatpaks
We can't use session_bus_down() in the test since gdocumentportal.c
holds a reference to the session bus connection, preventing it from
being finalised.
2019-12-17 20:59:22 +08:00
James Henstridge
27db702ceb gio/tests: add a fake implementation of the document portal 2019-12-17 20:56:49 +08:00