Commit Graph

6111 Commits

Author SHA1 Message Date
Philip Withnall
78b1278d44 Merge branch '488-assert-gobjects-dont-leak' into 'master'
gobject: Add a g_assert_finalize_object() macro

Closes #1780 and #488

See merge request GNOME/glib!859
2019-07-25 15:42:39 +00:00
Philip Withnall
b6d4da7684 tests: Use g_object_assert_last_unref() in various tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-25 15:23:21 +01:00
Emmanuele Bassi
17be9e5c4c Merge branch '436-test-coredumps' into 'master'
Fix tests creating coredumps

Closes #436

See merge request GNOME/glib!959
2019-07-25 13:49:09 +00:00
Emmanuele Bassi
298ee8f87c Merge branch '1791-macos-get-mime-dirs' into 'master'
gcontenttype: Add no-op versions of {get,set}_mime_dirs() on win32/macOS

Closes #1791

See merge request GNOME/glib!927
2019-07-25 13:48:04 +00:00
Philip Withnall
3de1b88339 gcontenttype: Add no-op versions of {get,set}_mime_dirs() on win32/macOS
These are here to prevent linker errors, since `gcontenttype.[ch]`
aren’t compiled on Windows or macOS.

The implementations are stubs to be filled out by someone who knows each
platform, at some point in the future.

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

Fixes: #1791
2019-07-24 14:50:53 +01:00
Emmanuele Bassi
00d7568e4f build: Remove unsupported install directives
We're using the `install` argument for configure_file() all over the
place.

The support for an `install` argument for configure_file() was added in
Meson 0.50, but we haven't bumped the minimum version of Meson we
require, yet; which means we're getting compatibility warnings when
using recent versions of Meson, and undefined behaviour when using older
versions.

The configure_file() object defaults to `install: false`, unless an
install directory is used. This means that all instances of an `install`
argument with an explicit `true` or `false` value can be removed,
whereas all instances of `install` with a value determined from a
configuration option must be turned into an explicit conditional.
2019-07-24 12:45:02 +01:00
Simon McVittie
3f1a79a4fa Merge branch 'allow_guid_key_in_dbus_addresses' into 'master'
Allow guid key in dbus addresses

Closes #1018

See merge request GNOME/glib!995
2019-07-23 13:01:09 +00:00
Дилян Палаузов
74583affe0 Add (out) annotation to (optional) parameters
… as the parameters are not (inout).

Closes #1837
2019-07-23 11:41:42 +00:00
Philip Withnall
249299a76f Merge branch 'doc-fixes' into 'master'
Various doc fixes

See merge request GNOME/glib!982
2019-07-17 10:58:21 +00:00
Philip Withnall
fa4423d435 Merge branch 'clang-cl-support' into 'master'
Experimental clang-cl support

See merge request GNOME/glib!979
2019-07-17 10:30:28 +00:00
Matthew Leeds
0c495f3dbf gdbusaddress: Add missing transfer annotation 2019-07-16 13:43:20 -07:00
Emmanuel Fleury
6a1512ed65 Allow guid key in dbus addresses
Original patch from William Hua

Fix issue #1018
2019-07-16 10:34:42 +02:00
Matthew Leeds
ce9ea30b1d gio: Fix minor docs mistakes 2019-07-15 16:07:18 -07:00
Philip Withnall
2ac44f3111 Merge branch 'key-file-no-file' into 'master'
key file: Handle filename being NULL

Closes #1825

See merge request GNOME/glib!984
2019-07-15 12:50:45 +00:00
Philip Withnall
493b8ca021 Merge branch 'keyfile-portal-fixes' into 'master'
Keyfile portal fixes

See merge request GNOME/glib!985
2019-07-15 12:32:01 +00:00
Matthias Clasen
addb8c158a 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:01:56 +01:00
Matthias Clasen
9c5d3a6081 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:01:56 +01:00
DDoSolitary
2718245dc2 Fix test failures for static builds
The plugin modules in these tests get statically linked with a separate
copy of GLib so they end up calling vfuncs in their own copy of GLib.

Fixes #1648
2019-07-15 11:01:04 +00:00
Nirbheek Chauhan
5e7f12b0ce gio/tests: Remove code and comments referring to libtool 2019-07-13 12:23:07 +05:30
Riccardo Bortolato
2b1a9219f1 windows: fix multicast socket binding to specific network interfaces
v7, based on a patch by mrgard (GNOME/glib#1635)
make w32_adapter_ipv4_addr() C90-compliant
check for ERROR_BUFFER_OVERFLOW when calling GetAdaptersAddresses()
code-style fixes
indentation fixes
use g_try_(re)alloc and g_free
style suggestions by pwithnall
drop uni_count variable
cap maximum allowed interface name string length according to windows documentation

Fixes: #1635
2019-07-12 15:21:53 +02:00
Chun-wei Fan
e8d471f3e1 meson: Mostly assume clang-cl is MSVC
We need to enable building the dirent and gnulib sources for clang-cl,
as we are still using the Microsoft-style headers and lib's and CRT.
We need to also do this for the following, for similar reasoning:

-Symbol export (via __declspec(dllexport))
-Dependency discovery without pkg-config files
-long long and ssize_t detection

We do, however, enable the autoptr tests for clang-cl builds.  Note that
at this point real MSVC builds are still better supported than clang-cl
builds, and it will likely remain so for at least the near future,
alhtough real MSVC builds of the GTK stack are consumable and are usable
by clang-cl.
2019-07-11 15:38:21 +08:00
Matthias Clasen
953f23f13c 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-10 11:14:03 -04:00
Xavier Claessens
8381ce472f doc: Hide some internal function 2019-07-10 10:29:04 -04:00
Xavier Claessens
5c9af3c75c doc: Add some empty lines to unbreak gtkdoc
For some reason gtkdoc thinks g_test_trap_fork() is undefined, unless
some more spacing is added.
2019-07-10 10:10:49 -04:00
Sonny Piers
40b3efe931 gio: fix typo in g_settings_reset documentation 2019-07-10 13:51:53 +00:00
Chun-wei Fan
45a21dcc3a Merge branch 'fix-module-tests-msvc' into 'master'
Fix module tests on Visual Studio builds

See merge request GNOME/glib!937
2019-07-10 07:30:41 +00:00
Matthias Clasen
5f8d787815 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-08 10:32:18 -04:00
Sonny Piers
06f27fc208 doc: fix typo in gio/gresource.c 2019-07-08 10:48:23 +00:00
Philip Withnall
4e538e674c Merge branch 'bug-787-investigation' into 'master'
Fix memory error with GDBusConnection in g_test_dbus_down()

Closes #787

See merge request GNOME/glib!963
2019-07-05 11:52:28 +00:00
David Strauss
979c92df17 Fix typo in request handle 2019-07-04 16:23:44 +00:00
Matthew Leeds
d4db5a8288 gtestdbus: Clarify comment on dropping connection ref
In _g_object_unref_and_wait_weak_notify() we take a weak reference and
then call g_object_unref() in an idle callback, which may look like
we're dropping a strong reference without having one. So change the
comment to make it more clear that the reference being dropped is held
by the caller.
2019-07-03 20:28:36 -07:00
Matthew Leeds
59ce6b10dc gdbus-connection-loss: Fix test failure
Now that we're not calling g_object_run_dispose() indirectly in
g_test_dbus_down() (see commit "Revert "gtestdbus: Properly close server
connections""), the test gdbus-connection-loss is failing with the
message "Bail out! GLib-GIO-FATAL-WARNING: Weak notify timeout, object
ref_count=1". This is because we're holding a reference to the singleton
connection object while calling session_bus_down() in the test's main().
So then we end up waiting for 30 seconds in
_g_object_unref_and_wait_weak_notify() for the GWeakNotify to be
triggered, which never happens.

The fix is to unref the connection before calling session_bus_down().
This is consistent with how other tests work, and is safe because the
only method called on the connection has already errored out, as
asserted by the test.
2019-07-03 20:28:36 -07:00
Matthew Leeds
1c63d5d539 Revert "Work around test failure in gdbus-names"
This reverts commit c37cd19fee.

Now that we've reverted the commit "gtestdbus: Properly close server
connections", g_test_dbus_down() no longer returns early and we no
longer need this workaround. Since the gdbus-names test seems to
properly unref its GDBusConnection objects it's not clear to me why it
needed the sleep to succeed. However even at the time the failure wasn't
reproducible according to this comment[1] so it's probably not worth
spending more effort trying to reproduce it now.

[1] https://gitlab.gnome.org/GNOME/glib/issues/787#note_214235
2019-07-03 20:21:34 -07:00
Matthew Leeds
d03025ba10 Revert "gtestdbus: Properly close server connections"
This reverts commit baf92d09d6.

Closes #787

According to the original commit, this change was made because otherwise
g_test_dbus_down() following a g_test_dbus_stop() hangs until it times
out. The timeout being referred to is the 30 seconds which are waited by
_g_object_unref_and_wait_weak_notify() for the GWeakNotify to be
triggered when the last strong reference to the singleton
GDBusConnection object is dropped. But the patch was not correct and the
leak should have instead been fixed by having the last strong reference
holder drop their reference on the GDBusConnection before calling
g_test_dbus_down(). Timing out after 30 seconds is the desired behavior
in the case where someone holds a reference to the singleton for that
entire period.

There are a few problems with this patch. First, as pointed out here[1],
calling g_object_run_dispose() in the idle callback means we are causing
the GWeakNotify to trigger ~immediately rather than waiting 30 seconds
to give another owner a chance to unref. Second, since someone else may
still hold a reference on the object being disposed, they may call
methods on it after it's been disposed which can seg fault as documented
here[2] and as I also saw recently in another project.

It's unclear what the original leak being fixed was, but many have been
fixed between 2013 and now. I ran all the unit tests under valgrind, and
some do fail (some consistently and some intermittently) but none of the
failures seem to only happen after this reversion commit. I also
couldn't find anywhere in the valgrind output where any GDBusConnection
objects are definitely being lost.

[1] https://gitlab.gnome.org/GNOME/glib/issues/787#note_214226
[2] https://gitlab.gnome.org/GNOME/glib/issues/787#note_214237
2019-07-03 20:01:22 -07:00
Emmanuel Fleury
7c0b11248f Fixing find_enclosing_mount() documentation
Fix issue #453
2019-07-01 15:00:42 +02:00
Philip Withnall
d55f6fb5fe gdesktopappinfo: Update calling convention for gnome-terminal
For several years now (I haven’t looked up the exact date),
`gnome-terminal` has preferred being called as `gnome-terminal
--terminal-args -- /some/other/program --its-args` rather than as
`gnome-terminal --terminal-args -x /some/other/program --its-args`.
Since 2017 it has warned about uses of `-x` (see
ad4edbd118).

So we should change our calling convention for it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-06-28 13:05:07 +01:00
Philip Withnall
d50caa8fb9 tests: Don’t spawn test processes via the terminal in the appinfo test
There seems to be no reason to do so, and since the `appinfo` test was
ported to use `G_TEST_OPTION_ISOLATE_DIRS`, it has been causing
coredumps to accumulate. `gnome-terminal` was chosen as the terminal,
but it couldn’t find its GSettings schemas due to all the XDG
environment variables being cleared to `/dev/null` by
`G_TEST_OPTION_ISOLATE_DIRS`.

In order to keep using `gnome-terminal` as a subprocess in the tests,
we’d need to explicitly set up its environment so it can load the right
GSettings schemas. That’s a lot of work for not much gain.

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

Helps: #436
2019-06-28 13:05:07 +01:00
LRN
5e7c18fa48 Merge branch 'nirbheek/preliminary-uwp-support' into 'master'
Preliminary patches for Universal Windows Platform support

See merge request GNOME/glib!951
2019-06-27 16:08:59 +00:00
Matthew Leeds
1f49c5aaeb gio: Make minor docs improvements
This commit changes a comment in _g_dbus_worker_do_read_cb() to be
slightly more useful. At least in my experience debugging an
intermittent unit test failure in another project, this failure
condition occurred because although g_test_dbus_down() ensures that the
session GDBusConnection has exit-on-close set to FALSE before killing
its dbus-daemon, there was still a GDBusConnection on the system bus
which hit this failed read code path, because we had
DBUS_SYSTEM_BUS_ADDRESS set to the address of the #GTestDBus daemon, to
appease libudisks.

Also, make a few other minor improvements to the docs.
2019-06-25 11:11:33 -07:00
Nirbheek Chauhan
cdc2a798cf uwp: workaround a false positive in certification of glib
It seems that the Windows App Certification Kit searches all files and
binaries for the regex '\<reg\>' (or something like it) and throws
errors if it exists. Supposedly this is for preventing apps from
running REG.EXE

https://blogs.msdn.microsoft.com/appconsult/2017/08/16/how-to-validate-if-your-application-is-compliant-with-the-windows-store-polices-windows-10-and-windows-10-s/
2019-06-25 13:09:04 +05:30
Chun-wei Fan
dbea8d5449 Fix module tests on Visual Studio builds
On Visual Studio, Meson builds modules as xxxx.dll, not libxxxx.dll when
xxxx is specified as the name for the shared_module() build directive.

This means that in the test programs if we expect for libxxxx for the
module name, the test will fail as there is no libxxxx.dll but there is
xxxx.dll.  This makes the test program look for the module files
correctly.
2019-06-24 10:58:58 +08:00
Chun-wei Fan
edc5eb98c2 gio/tests/resourceplugin.c: Ensure entry points are exported
Ensure that the entry points/symbols are exported on Visual Studio
builds as well.
2019-06-24 10:58:51 +08:00
Matthias Clasen
99764fd8fa list model: Expand items-changed docs
Point out explicitly that positions change
when ::items-changed is emitted.
2019-06-21 15:53:51 +00:00
Philip Withnall
f8bad07319 Merge branch 'gdbusproxy_prefixes_unstripped_error' into 'master'
gdbus: proxy : Strip remote error on activation failure

Closes #804

See merge request GNOME/glib!925
2019-06-18 10:30:37 +00:00
Philip Withnall
1888deecfc Merge branch 'glib.fixtools.i18n' into 'master'
Tools: Correctly show translated messages on more recent Visual Studio builds

Closes #1169

See merge request GNOME/glib!895
2019-06-18 10:18:31 +00:00
Chun-wei Fan
3046f7b3bb gio-tool.c: Don't hardcode localedir on Windows
We ought to construct the localedir based on the location of the GLib
DLL, like what the other tools do.
2019-06-18 17:29:41 +08:00
Chun-wei Fan
9f709fe1e9 gio tools: Use the proper string for default locale for setlocale()
This makes use of the string we now have from glib-private.h in the
last commit so that setlocale() sets the default system locale
correctly and therefore show the translated messages properly.

Fixes issue #1169.
2019-06-18 17:29:41 +08:00
Emmanuel Fleury
ca7a29e8e0 gdbus: proxy : Strip remote error on activation failure
Original patch proposed by Christian Persch

Related to issue #804
2019-06-18 10:54:09 +02:00
Christian Hergert
22ba4411cc gio: remove use of generic marshaller from GIO objects
Using the generic marshaller has drawbacks beyond performance. One such
drawback is that it breaks the stack unwinding from the Linux kernel due
to having unsufficient data to walk past ffi_call_unixt64. That means that
performance profiling by application developers looks grouped among
seemingly unrelated code paths.

While we can't fix the kernel unwinding here, we can provide proper
c_marshallers and va_marshallers for objects within Gio so that
performance profiling of applications is more reliable.

Related to GNOME/Initiatives#10
2019-06-17 16:29:09 -07:00
Christian Hergert
273c00f620 gio: ensure default va_marshaller is used
If c_marshaller is provided during g_signal_new() registration, the
automatic va_marshaller will not be set. If we leave the c_marshaller as
NULL in the simple cases, both a c_marshaller and va_marshaller will be
set for us.

This is particularly helpful when dealing with stack traces from Linux
perf, which often cannot unwind the stack beyond the ffi_call_unix64
stack-frame on x86_64.

Related to GNOME/Initiatives#10
2019-06-17 16:13:53 -07:00
Christian Hergert
d7c1d477bc gdbusobjectmanager: store signal ids for re-use
Having access to the signal-id is useful when we want to specify additional
signal related settings (such as va_marshaller).
2019-06-17 16:13:53 -07:00
Simon McVittie
833d38b40f Merge branch 'mcatanzaro/gdbus-dir-addresses' into 'master'
gdbus: support unix:dir= addresses, and related cleanups

Closes #1808

See merge request GNOME/glib!911
2019-06-17 18:06:11 +00:00
Michael Catanzaro
30524fbdb5 gdbusserver: properly escape all components of server address
https://gitlab.gnome.org/GNOME/glib/merge_requests/911#note_530668
2019-06-17 12:08:06 -05:00
Michael Catanzaro
16cdda5d35 gdbus: run peer test multiple times with different addresses
This ensures that D-Bus connections established with unix:dir and
unix:path addresses actually work properly. Previously, we only tested
unix:tmpdir and TCP addresses.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
eca16677c0 gdbus: Fix minor leak in peer test
This has to be freed even on Windows.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
beac9fe211 gdbus: Clean up sockets and nonces from filesystem
When we close the GDBusServer, it should remove any non-abstract Unix
sockets or TCP nonce files it created from the filesystem.

Fixes #1808
2019-06-17 12:08:06 -05:00
Michael Catanzaro
f5631ecb94 gdbus: improve an error message
Namespace is one word.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
99b580a0b2 gdbus: Stop server on dispose
This is not going to have much any effect currently since stop() just
disconnects a signal handler (that is going to be disconnected in
finalize anyway) and stops the socket service (that is going to be
destroyed in finalize), but it makes sense to do here for robustness.
2019-06-17 12:08:06 -05:00
Michael Catanzaro
fc597fa5f9 gdbus: support unix:dir= addresses
unix:dir= addresses are exactly the same as unix:tmpdir= addresses,
already supported by GDBus, except they forbid use of abstract sockets.
This is convenient for situations where abstract sockets are
impermissible, such as when a D-Bus client inside a network namespace
needs to connect to a server running in a different network namespace.
An abstract socket cannot be shared between two processes in different
network namespaces.

Applications could use unix:path= addresses instead, so this is only a
convenience, but there's no good reason not to support unix:dir=.
Currently it is not supported simply because unix:dir= is a relatively
recent addition to the D-Bus spec.
2019-06-17 12:07:10 -05:00
Michael Catanzaro
6a5c4252cd Merge branch '940-socket-listener-docs' into 'master'
gsocketlistener: Clarify when g_socket_listener_set_backlog() works

Closes #940

See merge request GNOME/glib!921
2019-06-17 17:05:42 +00:00
Philip Withnall
063722ef80 gsocketlistener: Clarify when g_socket_listener_set_backlog() works
Spotted by Paolo Borelli.

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

Fixes: #940
2019-06-17 16:26:48 +01:00
Philip Withnall
25636e50e0 gdbusmessage: Fix comparisons out of range for enum types
This was warning on macOS.

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

Fixes: #887
2019-06-17 15:45:30 +01:00
Philip Withnall
fa5996927f Merge branch 'drop-g-disable-deprecated' into 'master'
Drop G_DISABLE_DEPRECATED

Closes #1060 and #638

See merge request GNOME/glib!871
2019-06-14 11:24:25 +00:00
Emmanuele Bassi
94a56ae4f5 Merge branch '1807-dbus-server-docs' into 'master'
gdbusserver: Drop reference to non-existing function from documentation

Closes #1807

See merge request GNOME/glib!913
2019-06-12 12:05:56 +00:00
Philip Withnall
b1fbb36ba3 Merge branch 'prop-action-state-hints' into 'master'
property action: Add state hints

See merge request GNOME/glib!906
2019-06-12 11:59:58 +00:00
Philip Withnall
6e25d936fa gdbusserver: Drop reference to non-existing function from documentation
Spotted by Michael Catanzaro.

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

Fixes: #1807
2019-06-12 12:48:49 +01:00
Sebastian Dröge
03ce878736 Merge branch '1729-mime-result-prio' into 'master'
Resolve "g_content_type_guess segfaults when passed an empty data buffer on Mac OS"

Closes #1729

See merge request GNOME/glib!733
2019-06-11 11:38:33 +00:00
Sebastian Dröge
f78194e8d0 Merge branch 'settings-list-order' into 'master'
gsettings: Document that lists are returned in no defined order

See merge request GNOME/glib!851
2019-06-11 11:35:58 +00:00
Sebastian Dröge
e85f1ced5f Merge branch 'compile-schemas-strings' into 'master'
glib-compile-schemas: Improve translatable strings

See merge request GNOME/glib!678
2019-06-11 11:34:05 +00:00
Simon McVittie
11233f572d 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:36 +01:00
Simon McVittie
a5923d4e49 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:36 +01:00
Simon McVittie
281a03d603 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:36 +01:00
Simon McVittie
1da3280b9e 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:35 +01:00
Simon McVittie
f5a01e0e4a GDBusServer: Document that a GDBusAuthObserver is usually desirable
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 11:06:35 +01:00
Simon McVittie
5e24d7cd14 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:35 +01:00
Philip Withnall
f6736a2589 tests: Use a temporary directory for testfilemonitor
Previously, its tests were being run in the build directory, which is
fine (it should always be writable). If multiple tests were run in
parallel, for example with Meson’s `--repeat` option, their test files
would collide.

Fix that by running each test instance in a separate subdirectory of
`/tmp`.

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

Helps: #1634
2019-06-10 15:19:34 +01:00
Philip Withnall
f124349fa1 tests: Improve debug output on testfilemonitor failure
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1634
2019-06-10 14:58:45 +01:00
Matthias Clasen
459c4f296a property action: Add state hints
We have this information in the param specs,
we might as well pass it on to give consumers
a chance to present meaningful UIs for these
actions.
2019-06-10 00:03:25 +00:00
Philip Withnall
4e00fdea9b Merge branch 'filio' into 'master'
Include <sys/filio.h> for FIONREAD

See merge request GNOME/glib!889
2019-06-05 11:24:56 +00:00
Allison Karlitskaya
efeaf8f747 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-04 20:09:26 +01:00
Allison Karlitskaya
97f8d3e1d8 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 20:09:26 +01:00
Maya Rashish
de2ad60578 Include <sys/filio.h> for FIONREAD 2019-06-04 13:13:37 +03:00
Philip Withnall
b73713d893 tests: Add a test for g_content_type_guess() with no arguments
It should produce a generic result, but not crash. It was previously
crashing on macOS.

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

Fixes: #1729
2019-06-03 12:16:50 +01:00
Philip Withnall
4a0cb8f3a1 xdgmime: Don’t set an out argument if it’s NULL
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1729
2019-06-03 12:13:53 +01:00
Philip Withnall
d586ab4c73 tests: Use g_assert_*() instead of g_assert() in contenttype tests
g_assert_*() give more helpful error messages on failure, and aren’t
compiled out by G_DISABLE_ASSERT.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-06-03 12:13:53 +01:00
Sebastian Dröge
a4d01fcd4b Merge branch '1796-gio-pkg-bin-variables' into 'master'
build: Add various installed utilities to gio-2.0.pc

Closes #1796

See merge request GNOME/glib!881
2019-06-03 10:43:44 +00:00
Philip Withnall
799caf772b gsubprocess: Add missing (nullable) annotation to get_identifier()
The bottom of the documentation comment for this symbol seems to have
been missing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 23:38:58 +01:00
Philip Withnall
7f256e63d0 tests: Fix small race in GSubprocess tests
This was introduced in commit 7846d6154a: g_subprocess_get_identifier()
will return NULL after the subprocess has exited, and the subprocess in
the `noop` test will exit as soon as it has started spawning. So if the
scheduler scheduled the testprog subprocess quickly, descheduled the
parent test process until the testprog exited, then the return value
from g_subprocess_get_identifier() would be NULL.

Move the g_subprocess_get_identifier() test to one which calls testprog
in `sleep-forever` mode, since that is guaranteed not to exit until
killed (which we do later in the test).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 23:35:27 +01:00
Philip Withnall
3a9f9e3509 build: Add various installed utilities to gio-2.0.pc
The most useful ones were already listed in the pkg-config file, but
some others (notably, `gio-querymodules`) were not. List them in the
pkg-config file with their installed paths so that the right binary is
used if GIO is installed in a non-default path.

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

Fixes: #1796
2019-05-31 21:23:05 +01:00
Philip Withnall
e37f0cbd89 gnetworkmonitornm: Consider NM_STATE_CONNECTED_SITE to be available
`NM_STATE_CONNECTED_SITE` is documented to mean that a default route is
available, but that the internet connectivity check failed. A default
route being available is compatible with the documentation for
GNetworkMonitor:network-available, which should be true if the system
has a default route for at least one of IPv4 and IPv6.

https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html

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

Fixes: #1788
2019-05-31 11:19:07 +01:00
Sebastian Dröge
8b3f186d8f Merge branch '1790-file-attribute-as-string-annotation' into 'master'
gfileinfo: Add missing (nullable) annotation to get_attribute_as_string()

Closes #1790

See merge request GNOME/glib!879
2019-05-31 10:16:43 +00:00
Sebastian Dröge
c1a15894e4 Merge branch 'writev-max-num-vectors' into 'master'
Clamp number of vectors to IOV_MAX / UIO_MAXIOV for GOutputStream writev()...

See merge request GNOME/glib!874
2019-05-31 10:04:57 +00:00
Philip Withnall
ebacb64539 gfileinfo: Slightly improve documentation formatting
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 10:58:10 +01:00
Philip Withnall
67a0d5237e gfileinfo: Add missing (nullable) annotation to get_attribute_as_string()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1790
2019-05-31 10:58:00 +01:00
Sebastian Dröge
20a2c379c4 Clamp number of vectors to IOV_MAX / UIO_MAXIOV for GOutputStream writev() calls in the implementations
More vectors will give an error and we can simply clamp here and
consider it like a short write instead.

In case of GSocketOutputStream this is done here instead of inside
GSocket before calling sendmsg() because we we can't generically handle
short writes when sending messages on a socket, e.g. for datagram
sockets this causes only part of the datagram to be sent and an error
would be more useful in this case than sending corrupted data.

Also reduce the fallback limit to 16 in gsocket.c as that's the minimum
value required by POSIX and add a static assertion that the limit is
never bigger than G_MAXINT as that's the type recvmmsg/sendmmsg take.
2019-05-31 12:51:59 +03:00
Philip Withnall
947355c101 Merge branch 'wip/oholy/copy-permissions' into 'master'
CVE-2019-12450: gfile: Limit access to files when copying

See merge request GNOME/glib!876
2019-05-31 09:09:30 +00:00
Philip Withnall
40ff475977 Annotate various types and macros as deprecated
These have all been documented as deprecated for a long time, but we’ve
never had a way to programmatically mark them as deprecated. Do that
now.

This is based on the list of deprecations from the reverted commit
80fcb1bc2.

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

Fixes: #638
2019-05-30 10:39:11 +01:00
Philip Withnall
1741fc2c6e build: Drop use of G_DISABLE_DEPRECATED from the build system
It’s no longer used in any of the headers. See preceding commits.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
e62e89f2f8 Fix various deprecation warnings in code and tests
This code uses, or tests, deprecated functions, types or macros; so
needs to be compiled with deprecation warnings disabled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
b4d58a7105 glib, gio: Use GLIB_DEPRECATED_MACRO instead of G_DISABLE_DEPRECATED
When defining deprecated macros, annotate them with
`GLIB_DEPRECATED_MACRO_IN_*()` and `GLIB_DEPRECATED_MACRO_IN_*_FOR()` to
conditionally emit warnings if people use them, depending on their
declared minimum and maximum GLib version requirements (see
`GLIB_VERSION_MIN_REQUIRED` and `GLIB_VERSION_MAX_ALLOWED`).

The old way of doing this was for users to define `G_DISABLE_DEPRECATED`
if they didn’t want to use deprecated APIs, but it reported errors via
missing symbols, and wasn’t version-dependent. It’s being phased out.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00