Commit Graph

19198 Commits

Author SHA1 Message Date
Matthias Clasen
860735f01b portal network monitor: Drop the version property
Rearrange the code so we try version 3 first,
falling back to version 2 and then version 1.

We still do a construct-time check to ensure
that we work with unsupported versions.

Note that this also takes care of setting the
initial property values in the version 1 case.
2018-08-27 10:55:53 -04:00
Matthias Clasen
5c5881b2ed portal network monitor: use GetStatus when available
Version 3 of the portal interface adds a GetStatus
method that gets all data in a single roundtrip.
Use it when available.
2018-08-27 10:55:30 -04:00
Matthias Clasen
a090d8605b portal network monitor: Implement can_reach
Version 3 of the network monitor portal interface adds
a CanReach method. Use it to implement can_reach.

The docs state that can_reach will either return TRUE
or set an error. So, set an error of G_IO_ERROR_HOST_UNREACHABLE
when the portal returns FALSE for CanReach.
2018-08-27 10:55:01 -04:00
Matthias Clasen
3a3a32a2bb portal network monitor: Always emit ::network-changed
The documentation of this signal is not really clear,
but it seems safer to emit it for all changes, even
if available is unchanged.
2018-08-27 10:54:35 -04:00
Matthias Clasen
8f2393b9b6 Whitespace fixup 2018-08-27 10:48:06 -04:00
Changwoo Ryu
d79d1d9dfe Update Korean translation 2018-08-27 14:12:03 +00:00
Philip Withnall
b9cfbf0e62 Merge branch 'schemasdir' into 'master'
gio: Provide schemas directory information in pkg-config file

See merge request GNOME/glib!274
2018-08-27 13:19:38 +00:00
Iñigo Martínez
64e9e1f482 gio: Provide schemas directory information in pkg-config file
GSettings XML schema files are installed in a well known directory
under Glib's installation directory: `glib-2.0/schemas`. However,
the Glib installation directory might vary, so the exact location of
the schema files might be unknown.

The information regarding this directory has been added to GIO's
pkg-config file, so it can be checked, and also overrided, by using
the command line utility.
2018-08-27 13:50:34 +02:00
Philip Withnall
297941e049 Merge branch 'ossfuzz-9805-variant-parser-overflow' into 'master'
gvariant: Fix more bounds checking in GVariant text format parser

See merge request GNOME/glib!239
2018-08-27 10:14:32 +00:00
Philip Withnall
3cafd7f266 Merge branch 'wip/chergert/garray-bail' into 'master'
garray: add overflow checks before expanding array

See merge request GNOME/glib!195
2018-08-27 10:09:58 +00:00
Milo Casagrande
608cb8050c Update Italian translation 2018-08-27 07:56:50 +00:00
Emin Tufan Çetin
7a41cc0c3b Update Turkish translation 2018-08-26 18:13:22 +00:00
Kukuh Syafaat
fba393134b Update Indonesian translation 2018-08-26 13:49:59 +00:00
Philip Withnall
41cc3850ff dtrace: Add missing const attributes to types in glib_probes.d
This eliminates some ‘discards const qualifier’ warnings when compiling
on Solaris with --enable-dtrace.

See the log files in
https://gitlab.gnome.org/GNOME/glib/issues/1493#note_299037.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-25 23:59:45 +01:00
Baurzhan Muftakhidinov
f59cb6827a Update Kazakh translation 2018-08-25 17:35:32 +00:00
Philip Withnall
ddcef78a84 Merge branch 'autotools-mingw-c99-format' into 'master'
autotools: use C99 printf format specifiers on Windows. Fixes #1497

Closes #1497

See merge request GNOME/glib!271
2018-08-25 12:36:15 +00:00
Philip Withnall
647e01e20c Merge branch 'autotools-remove-__int64' into 'master'
autotools: remove support for the __int64 type. See #1313

See merge request GNOME/glib!270
2018-08-25 12:34:40 +00:00
Philip Withnall
f9e28a9b9a Merge branch 'ci-autotools-v2' into 'master'
ci: Add an autotools job

See merge request GNOME/glib!267
2018-08-25 12:33:55 +00:00
Christoph Reiter
3d7cde654c autotools: use C99 printf format specifiers on Windows. Fixes #1497
Since we now require a C99 compatible printf and use gnulib on Windows,
we also mark our printf functions as gnu_printf. GCC complains about the
Windows specific I64 specifiers we still write to glibconfig.h with the
autotools build.

To fix this switch all I64(x) to ll(x).

This also makes the glibconfig.h output for those macros match the ones
we get when using meson.
2018-08-24 22:42:42 +02:00
Christoph Reiter
7e821441c4 autotools: remove support for the __int64 type. See #1313
__int64 was the 64bit type for Visual Studio before it added support for
"long long" with VS2013. I think this was used to build glib with mingw and
make the result usable for VS 6.0 which didn't support "long long" (??)

Given that newer MSVC links against a different crt and mixing is not supported
and everything supports "long long" nowadays just remove it.

This is also a cleanup for printf format changes needed for #1497
2018-08-24 21:38:07 +02:00
Christoph Reiter
856f7ebe2b ci: Add an autotools job 2018-08-24 18:12:22 +02:00
Christoph Reiter
11fcc2f1ac build: simplify alloca checks. See #1313
The goal of this commit is to reduce differences between the autotools and meson build.

With autotools AC_FUNC_ALLOCA was used which defines HAVE_ALLOCA_H, HAVE_ALLOCA,
C_ALLOCA. meson tried to replicate that with has_function() but alloca can be a macro
and and is named _alloca under Windows. Since we require a working alloca anyway
and only need to know if the header exists replace AC_FUNC_ALLOCA with a simple
AC_CHECK_HEADERS.

There is still one user of HAVE_ALLOCA in the embedded gnulib, but since alloca is
always provided through galloca.h just force define HAVE_ALLOCA there and add a comment.

The docs were mentioning alloca as an example for cross compiling. Since that variable no
longer exists now replace it with another one.
2018-08-24 10:57:10 +02:00
Marco Trevisan (Treviño)
5cc4cca9c6 subprocess: Fix communicate_cancelled signature
The source callback for a GCancellable should have the cancellable itself
as first argument.
This was not the case, and when this code was hit, we were instead trying
to treat the pointer as a CommunicateState reference and thus wrongly
deferencing it, causing a memory error and a crash.
2018-08-24 06:05:03 +02:00
Philip Withnall
f2504be625 2.57.3
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-23 18:48:14 +01:00
Simon McVittie
ec4da774e5 Merge branch '1492-cast-function-type-warning' into 'master'
glist: Mention -Wcast-function-type problems with g_*list_copy_deep()

Closes #1492

See merge request GNOME/glib!253
2018-08-23 09:25:36 +00:00
Simon McVittie
4044343943 Merge branch 'gresource-distcheck-failure' into 'master'
build: Clean files left behind after gio/tests/gresource.c test

See merge request GNOME/glib!263
2018-08-23 09:18:52 +00:00
Ninja-Koala
0d685b4946
glib-compile-resources: encode data as string
Some Testing revealed encoding resource data with string
escape codes to compile significantly quicker compared
to the same data encoded as an array with hexadecimal numbers.
See #1489
2018-08-23 10:02:56 +02:00
Philip Withnall
d589c18845 Merge branch '972-integers-on-os-x' into 'master'
build: Mismatch between gint64 and int64_t in OSX 64-bit

Closes #972

See merge request GNOME/glib!256
2018-08-23 07:51:43 +00:00
Matthias Clasen
3c1902fcf9 Add a gnet utility
This is currently just a wrapper around GNetworkMonitor.
2018-08-23 02:59:28 +00:00
Emmanuele Bassi
2705fa7b55 Merge branch 'g-clear-pointer-no-side-effects' into 'master'
gmem: Only evaluate pointer argument to g_clear_pointer() once

See merge request GNOME/glib!262
2018-08-22 15:08:47 +00:00
Philip Withnall
2df9d38635 build: Clean files left behind after gio/tests/gresource.c test
This is a follow-up to commit 614adf8a75,
which started generating two new files as part of the test; they need to
be cleaned up before distcheck will pass.

Ideally, the test should run a temporary directory and wipe that
directory itself before exiting, but that’s a bit of a big change to
make right now. Deferred to
https://gitlab.gnome.org/GNOME/glib/issues/1495.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-22 15:01:56 +01:00
Philip Withnall
2e9c31af11 gmem: Only evaluate pointer argument to g_clear_pointer() once
The new typeof() macro version of g_clear_pointer() was evaluating its
pointer argument more than once, meaning any side effects would be
evaluated multiple times.

The existing (other) macro version of g_clear_pointer() was evaluating
its argument exactly once. This mismatch could have confused people or
lead to subtle bugs.

See https://gitlab.gnome.org/GNOME/glib/issues/1494.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-22 14:47:52 +01:00
Emmanuele Bassi
9a72ebe016 Merge branch '1494-clear-pointer-docs' into 'master'
gmem: Clarify calling convention behaviour of g_clear_pointer() in docs

Closes #1494

See merge request GNOME/glib!258
2018-08-22 11:22:58 +00:00
Philip Withnall
2bd09d56a2 Merge branch 'wip/sadiq/fixes' into 'master'
grefstring: Avoid an unnecessary NUL assignment

See merge request GNOME/glib!206
2018-08-22 11:21:23 +00:00
Emmanuele Bassi
c1d74052f5 Merge branch '1448-g-error-secretly-doesnt-abort' into 'master'
gmessages: Clarify documentation about aborting on fatal log levels

Closes #1448

See merge request GNOME/glib!254
2018-08-22 11:18:44 +00:00
Emmanuele Bassi
d77516df81 Merge branch '1465-bye-bye-g-gnuc-malloc' into 'master'
glib: Drop G_GNUC_MALLOC usage from various allocation functions

Closes #1465

See merge request GNOME/glib!260
2018-08-22 11:17:52 +00:00
Philip Withnall
c849a4ddd3 glib: Drop G_GNUC_MALLOC usage from various other allocation functions
These functions may be OK to leave the G_GNUC_MALLOC attribute on,
because the only valid pointers in the storage areas they return are,
themselves, new pointers.

However, it’s a lot easier to remove the attributes now than to try and
diagnose miscompilations in future. The performance impact of this is
likely to be unmeasurable. If there are performance problems caused by
this, then they can be profiled and fixed case-by-case in future,
bearing in mind the possibility for miscompilation if G_GNUC_MALLOC is
readded.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
082730fc3e glib: Drop G_GNUC_MALLOC usage from various allocation functions
These are our most critically incorrect uses of G_GNUC_MALLOC. See the
previous commit for details.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
c879f50f8a docs: Update the documentation for G_GNUC_MALLOC to reflect recent GCC
Thanks to some great investigation by Benjamin Moody, it’s clear that
our documentation and usage of G_GNUC_MALLOC has fallen behind GCC’s
interpretation of the malloc attribute, meaning that recent versions of
GCC could miscompile code which uses G_GNUC_MALLOC incorrectly.

Update the documentation of G_GNUC_MALLOC to match the current GCC
documentation (for GCC 8.2). Following commits will drop our use of
G_GNUC_MALLOC from inappropriate functions.

Specifically, the change in GCC’s interpretation of the malloc attribute
which could cause miscompilation is that returned storage areas are now
assumed to not contain valid pointers — so realloc() cannot have the
malloc attribute, and neither can a function which returns a newly
allocated structure with fields initialised to other pointers.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
a0456f9c96 gmessages: Clarify documentation about aborting on fatal log levels
Clarify that we actually raise SIGTRAP rather than calling abort(). We
haven’t called abort() since about 2011, when commit
a04efe6afb changed the logic to use
SIGTRAP to make it possible to skip past fatal log messages in the
debugger if they weren’t relevant to the problem being debugged.

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

https://gitlab.gnome.org/GNOME/glib/issues/1448
2018-08-22 10:37:15 +01:00
Philip Withnall
965bc6d857 gmem: Clarify calling convention behaviour of g_clear_pointer() in docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1494
2018-08-22 10:28:47 +01:00
Cheng-Chia Tseng
b2029fa9c7 Update Chinese (Taiwan) translation 2018-08-21 16:17:16 +00:00
John Ralls
5df3f42d7b build: Mismatch between gint64 and int64_t in OSX 64-bit
Check for compile warnings when assigning an int64_t* to a long*,
make gint64 a long long if they occur and assigning an int64_t* to
a long long* doesn't.

Modified by Philip Withnall <withnall@endlessm.com> to support Meson as
well as autotools.

https://gitlab.gnome.org/GNOME/glib/issues/972
2018-08-21 10:25:47 +01:00
Christoph Reiter
f6703db378 Merge branch 'mingw-statbuf-size' into 'master'
gstdio: use _stat64 for GStatBuf on 64bit mingw. Fixes #1476

Closes #1476

See merge request GNOME/glib!226
2018-08-20 10:48:16 +00:00
Christoph Reiter
63d3311c26 gstdio: use _stat64 for GStatBuf on 64bit mingw. Fixes #1476
The size of stat depends on various macros on Windows which leads to
the problem of size mismatches when glib is built with a different configuration
than a program using it.

For example the autotools build defaults to _FILE_OFFSET_BITS=64 and a program
not defining  _FILE_OFFSET_BITS will allocate a too small struct on the stack,
leading to stack corruption when glib writes to it.

To make the size the user sees always match the default mingw build define GStatBuf
as _stat64 (same as _FILE_OFFSET_BITS=64) under mingw+64bit.
2018-08-20 12:40:21 +02:00
Philip Withnall
3736139358 Merge branch 'mingw-file-offset-64' into 'master'
meson: define _FILE_OFFSET_BITS=64 for MinGW. See #1476

See merge request GNOME/glib!228
2018-08-20 10:25:53 +00:00
Philip Withnall
769326e1f1 Merge branch 'wip/lantw/fix-gtestdbus-crash-on-freebsd'
Manually rebased.

https://gitlab.gnome.org/GNOME/glib/merge_requests/251
2018-08-20 11:13:23 +01:00
Ting-Wei Lan
9147403893 gtestdbus: Fix watcher crash on FreeBSD
In file gio/gtestdbus.c, function watch_parent, there is a loop which
waits for commands sent from the parent process and kills all processes
recorded in 'pids_to_kill' array on parent process exit. The detection
of parent process exit is done by calling g_poll and checking whether
the returned event is G_IO_HUP. However, 'revents' is a bit mask, and
we should use a bitwise-AND check instead of the equality check here.

It seems to work fine on Linux, but it fails on FreeBSD because the
g_poll returns both G_IO_IN and G_IO_HUP on pipe close. This means the
watcher process continues waiting for commands after the parent process
exit, and g_io_channel_read_line returns G_IO_STATUS_EOF with 'command'
set to NULL. Then the watcher process crashes with segfault when calling
sscanf because 'command' is NULL. Since the test result is already
reported by the parent process as 'OK', this kind of crash is likely to
be unnoticed unless someone checks dmesg messages after the test:

pid 57611 (defaultvalue), uid 1001: exited on signal 11
pid 57935 (actions), uid 1001: exited on signal 11
pid 57945 (gdbus-bz627724), uid 1001: exited on signal 11
pid 57952 (gdbus-connection), uid 1001: exited on signal 11
pid 57970 (gdbus-connection-lo), uid 1001: exited on signal 11
pid 57976 (gdbus-connection-sl), uid 1001: exited on signal 11
pid 58039 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58043 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58047 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58051 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58055 (gdbus-export), uid 1001: exited on signal 11
pid 58059 (gdbus-introspection), uid 1001: exited on signal 11
pid 58065 (gdbus-names), uid 1001: exited on signal 11
pid 58071 (gdbus-proxy), uid 1001: exited on signal 11
pid 58079 (gdbus-proxy-threads), uid 1001: exited on signal 11
pid 58083 (gdbus-proxy-well-kn), uid 1001: exited on signal 11
pid 58091 (gdbus-test-codegen), uid 1001: exited on signal 11
pid 58095 (gdbus-threading), uid 1001: exited on signal 11
pid 58104 (gmenumodel), uid 1001: exited on signal 11
pid 58108 (gnotification), uid 1001: exited on signal 11
pid 58112 (gdbus-test-codegen-), uid 1001: exited on signal 11
pid 58116 (gapplication), uid 1001: exited on signal 11
pid 58132 (dbus-appinfo), uid 1001: exited on signal 11

If the watcher process crashes before killing the dbus-daemon process
spawned by the parent process, the dbus-daemon process will keep running
after all tests complete. Due to the implementation of 'communicate'
function in Python subprocess, it causes meson to crash. 'communicate'
assumes the stdout and stderr pipes are closed when the child process
exits, but it is not true if processes forked by the child process
doesn't exit. It causes Python subprocess 'communicate' function to
block on the call to poll until the timeout expires even if the test
finishes in a few seconds. Meson assumes the timeout exception always
means the test is still running. It calls 'communicate' again and
crashes because pipes no longer exist.

https://gitlab.gnome.org/Infrastructure/GitLab/issues/286
https://github.com/mesonbuild/meson/issues/3967
https://bugs.python.org/issue30154
2018-08-20 11:13:19 +01:00
Philip Withnall
282ad30c0c gslist: Fix a minor documentation syntax problem
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-20 11:00:54 +01:00
Philip Withnall
e81f4c2ace glist: Mention -Wcast-function-type problems with g_*list_copy_deep()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1492
2018-08-20 11:00:29 +01:00