Commit Graph

23647 Commits

Author SHA1 Message Date
Guido Günther
693ca5eb01 gdbusobjectmanagerclient: Cancel GetManagedObjects on dispose
Make sure there's no async call lingering when disposing the object.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 17:04:17 +02:00
Guido Günther
c548ac0796 gdbusobjectmanagerclient: Call GetManagedObjects async
This helps to void deadlocks when two processes call interfaces on each
other one of them being org.freedesktop.DBus.ObjectManager.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 15:27:36 +02:00
Guido Günther
04a4da8065 gdbusobjectmanagerclient: Move weak ref helpers upwards
This allows it to be used in on_notify_g_name_owner() as well

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 15:27:36 +02:00
Philip Withnall
d4ed690120 Merge branch 'DarkTrick-main-patch-77797' into 'main'
g_value_set_string description: clarified (unified), that v_string is a copy.

See merge request GNOME/glib!2167
2021-06-23 10:01:57 +00:00
DarkTrick
1fc905efe4 g_value_set_string description: clarified (unified), that v_string is a copy. 2021-06-23 05:50:59 +00:00
Michael Catanzaro
ed49de8b0f Merge branch 'mcatanzaro/gtlscertificate-introspection' into 'main'
gtlscertificate: Add more annotations to new properties

See merge request GNOME/glib!2166
2021-06-21 16:07:42 +00:00
Michael Catanzaro
5e19ccd237 gtlscertificate: Add more annotations to new properties 2021-06-21 16:07:42 +00:00
Philip Withnall
00868f4bb0 Merge branch 'mcatanzaro/#2393' into 'main'
gtlsconnection: use a vfunc to implement get_negotiated_protocol()

Closes #2393

See merge request GNOME/glib!2076
2021-06-21 15:22:24 +00:00
Michael Catanzaro
2cd187aa5e gio: add missing Since tags in GTlsConnection/GDtlsConnection 2021-06-21 09:31:17 -05:00
Michael Catanzaro
1ea88f46ff gdtlsconnection: document get_binding_data vfunc 2021-06-21 09:28:23 -05:00
Michael Catanzaro
09a4203b38 gtlsconnection: Add doc comment for GTlsConnectionClass 2021-06-21 09:28:23 -05:00
Michael Catanzaro
5e6c2e1e2c gtlsconnection: use a vfunc to implement get_negotiated_protocol()
The current code is unsafe to use from multiple threads at once.
GIOStream functions like this are supposed to be semi-threadsafe. It's
allowed for them to be called on both a reader thread and a writer
thread at the same time. Of course, it's still tricky and dangerous,
because it's only *really* threadsafe if the handshake has finished,
and API users have no plausible way to know that because the API
does not require performing an explicit handshake operation. But that's
a glib-networking problem. We can at least avoid the most obvious
threadsafety issue here in the API layer.

Note that we'll need to implement the new vfunc in glib-networking for
this to actually work.

Fixes #2393
2021-06-21 09:28:23 -05:00
Philip Withnall
74595ab64a Merge branch 'wip/pwithnall/962-drop-embedded-pcre' into 'main'
pcre: Drop internal libpcre copy

Closes #962 and #642

See merge request GNOME/glib!2144
2021-06-21 14:07:45 +00:00
Philip Withnall
4fe630db83 ci: Use default wrap mode for libpcre on cross-build platforms
Work around a bug in Meson versions < 0.50.0 where
`--wrap-mode=nodownload` would disable the use of fallback subprojects,
even if they’d already been downloaded, with the message:
```
Cross dependency libpcre found: NO (tried pkgconfig and cmake)
Cross dependency libpcre found: NO (tried pkgconfig)
Not looking for a fallback subproject for the dependency libpcre because:
Use of fallbackdependencies is disabled.
meson.build:1998:2: ERROR:  Dependency "libpcre" not found, tried pkgconfig
```

This workaround can be dropped in the near future when we bump our Meson
dependency to something less ancient. We have a self-imposed requirement
to be buildable using what’s packaged in Debian Stable, which is
currently Meson 0.49.2 — but the new Debian Stable release is coming
soon, with an updated Meson.

Using `--force-fallback-for=libpcre` would have been a more constrained
workaround, but unfortunately that argument didn’t exist in Meson 0.49.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #962
2021-06-21 13:29:56 +01:00
Philip Withnall
132d64db4d Merge branch 'mcatanzaro/misleading-indentation' into 'main'
testgdate: fix -Wmisleading-indentation warning

See merge request GNOME/glib!2162
2021-06-16 21:29:56 +00:00
Michael Catanzaro
0818da5308 testgdate: fix -Wmisleading-indentation warning
No behavior changes. Just reindent the existing code to avoid a GCC
warning spam.

I considered changing the code to not run fflush() on every iteration of
the loop, but I doubt it matters much, so I left it be.
2021-06-16 12:22:28 -05:00
Philip Withnall
54154d68bf build: Drop unused pcre_objects+pcre_deps variables in meson.build
After the previous few commits, these are now redundant.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-16 16:45:10 +01:00
Philip Withnall
9570e67744 pcre: Drop internal libpcre copy
It’s no longer used and is a maintenance burden.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #962
2021-06-16 16:45:10 +01:00
Philip Withnall
9fbd7f3dc1 build: Drop the internal_pcre option in favour of the subproject
This should maintain equivalent functionality, apart from that now you
have to pass `--force-fallback-for libpcre` to `meson configure` in
order to use the subproject; rather than specifying
`-Dinternal_pcre=true` to use the internal copy.

This also fixes #642, as the wrapdb copy of libpcre is version 8.37.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #962
Fixes: #642
2021-06-16 16:45:10 +01:00
Philip Withnall
1d952150e6 ci: Update to the latest CI images
These have been rebuilt to also cache the libpcre subproject.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #962
2021-06-16 16:45:10 +01:00
Philip Withnall
1602ca1d3e ci: Update Android and mingw CI images
Fedora 29 is no longer available, and I need to rebuild these images so
libpcre is pre-downloaded as a subproject.

Update them to Fedora 31, which is what we use in `fedora.Dockerfile`.
This should allow some blobs to be shared in the container repository.

This isn’t the latest Fedora release, but I don’t want to go through the
hassle of updating all the CI images to F33 right now in addition to
updating the subproject caches.

`python-unversioned-command` is needed because the Android NDK calls
`python` without a version number. F29 must have installed this already.
The Android NDK setup appears to be OK with Python 3.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #962
2021-06-16 16:45:10 +01:00
Philip Withnall
a695f922de Merge branch 'gbytes-test-coverage' into 'main'
tests: A few small improvements to GBytes tests

See merge request GNOME/glib!2152
2021-06-16 13:51:39 +00:00
Philip Withnall
b63a3189e7 tests: Add a test for GBytes memory transfer with an odd free func
This is basically a contrived test to trigger the `bytes->user_data !=
bytes->data` condition (and none of the earlier short-circuiting
conditions in that statement) in `try_steal_and_unref()`. This gives
100% line and branch coverage for `gbytes.c`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-16 12:14:58 +01:00
Philip Withnall
fc7b316bc7 tests: Test that g_bytes_unref(NULL) is a no-op
It’s documented as such, and this marginally increases the code coverage
on `gbytes.c`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-16 12:14:57 +01:00
Philip Withnall
082c2117bb tests: Use g_assert_*() rather than g_assert() in bytes.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-16 12:14:34 +01:00
Philip Withnall
9d694f636f Merge branch 'app_name' into 'main'
gfdonotificationbackend: set app_name if available

Closes #2069

See merge request GNOME/glib!2159
2021-06-16 11:07:55 +00:00
Philip Withnall
f6fdc9b5f2 Merge branch 'mcatanzaro/readable-private-key' into 'main'
gtlscertificate: make private key properties readable

See merge request GNOME/glib!2087
2021-06-16 11:01:40 +00:00
Philip Withnall
4d6dbe0904 Merge branch 'g_dbus' into 'main'
gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name()

Closes #402

See merge request GNOME/glib!2156
2021-06-16 10:58:04 +00:00
nitinosiris
a70df97c63 Added test case for g_dbus_is_error_name 2021-06-16 08:06:03 +05:30
nitinosiris
5b9a8e2048 gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name()
Closes #402
2021-06-16 08:05:50 +05:30
Michael Catanzaro
022ea47603 gtlscertificate: add some doc links to PKCS #11 specification 2021-06-15 16:06:52 -05:00
Michael Catanzaro
c50e543e9d gtlscertificate: make private key properties readable
WebKit wants these private key properties to be readable in order to
implement a deserialization function. Currently they are read-only
because at the time GTlsCertificate was originally designed, the plan
was to support PKCS#11-backed private keys: private keys that are stored
on a smartcard, where the private key is completely unreadable. The
design goal was to support both memory-backed and smartcard-backed
private keys with the same GTlsCertificate API, abstracting away the
implementation differences such that code using GTlsCertificate doesn't
need to know the difference.

The original PKCS#11 implementation was never fully baked and at some
point in the past I deleted it all. It has since been replaced with a
new implementation, including a GTlsCertificate:private-key-pkcs11-uri
property, which is readable. So our current API already exposes the
differences between normal private keys and PKCS#11-backed private keys.
The point of making the private-key and private-key-pem properties
write-only was to avoid exposing this difference.

Do we have to make this API function readable? No, because WebKit could
be just as well served if we were to expose serialize and deserialize
functions instead. But WebKit needs to support serializing and
deserializing the non-private portion of GTlsCertificate with older
versions of GLib anyway, so we can do whatever is nicest for GLib. And I
think making this property readable is nicest, since the original design
reason for it to not be readable is now obsolete. The disadvantage to
this approach is that it's now possible for an application to read the
private-key or private-key-pem property, receive NULL, and think "this
certificate must not have a private key," which would be incorrect if
the private-key-pkcs11-uri property is set. That seems like a minor
risk, but it should be documented.
2021-06-15 16:06:52 -05:00
André Apitzsch
53632c84d8 gfdonotificationbackend: set app_name if available
Fixes: #2069
2021-06-15 20:55:07 +02:00
Philip Withnall
00feb4d5a9 Merge branch 'wip/wait-status' into 'main'
Distinguish more clearly between wait status and exit status

See merge request GNOME/glib!1967
2021-06-15 18:22:02 +00:00
Ondrej Holy
757cc93520 Merge branch 'unix-mount-for-docs' into 'main'
gunixmounts: Document NULL return value for g_unix_mount_for()

See merge request GNOME/glib!2145
2021-06-15 15:29:58 +00:00
Simon McVittie
b483013d02 spawn: Clarify the most common non-exit reason for process termination
A reader might think "how would a process terminate without an exit
status?", or equivalently, "what harm would it do if I assume every
termination has an exit status?" without this reminder that termination
with a signal is also reasonably common.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:33:17 +01:00
Simon McVittie
e0b6b8037d Distinguish more clearly between wait status and exit status
On Unix platforms, wait() and friends yield an integer that encodes
how the process exited. Confusingly, this is usually not the same as
the integer passed to exit() or returned from main(): conceptually it's
an integer encoding of this tagged union:

    enum { EXITED, SIGNALLED, ... } tag;
    union {
        int exit_status;         /* if EXITED */
        struct {
            int terminating_signal;
            bool core_dumped;
        } terminating_signal;    /* if SIGNALLED */
        ...
    } detail;

Meanwhile, on Windows, wait statuses and exit statuses are
interchangeable.

I find that it's clearer what is going on if we are consistent about
referring to the result of wait() as a "wait status", and the value
passed to exit() as an "exit status".

GSubprocess already gets this right: g_subprocess_get_status() returns
the wait status, while g_subprocess_get_exit_status() genuinely returns
the exit status. However, the GSpawn family of APIs has tended to
conflate the two.

Confusingly, g_spawn_check_exit_status() has always checked a wait
status, and it would not be correct to pass an exit status to it; so
let's deprecate it in favour of g_spawn_check_wait_status(), which
does the same thing that g_spawn_check_exit_status() always did.
Code that needs backwards-compatibility with older GLib can use:

    #if !GLIB_CHECK_VERSION(2, 69, 0)
    #define g_spawn_check_wait_status(x) (g_spawn_check_exit_status (x))
    #endif

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:33:14 +01:00
Simon McVittie
f2be22ca52 subprocess test: Check wait status correctly
Confusingly, g_spawn_check_exit_status() takes a wait status, not an
exit status, so passing g_subprocess_get_exit_status() to it is
incorrect (although both encodings happen to use 0 to encode success
and a nonzero value to encode failure, so in practice this probably
had the desired effect).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:32:33 +01:00
Philip Withnall
031e5020ee Merge branch 'wip/pwithnall/local-file-monitor-deadlock' into 'main'
glocalfilemonitor: Avoid a deadlock on finalization

See merge request GNOME/glib!2155
2021-06-15 12:24:51 +00:00
Philip Withnall
7b6ccc8bdb Merge branch 'range-checked' into 'main'
GBytes: add range-checked pointer getter

Closes #1098

See merge request GNOME/glib!2147
2021-06-15 12:01:12 +00:00
Nitin Wartkar
e3452ea01f GBytes: add range-checked pointer getter
Updated and improved by Nitin Wartkar.

Fixes: #1098
2021-06-15 12:01:11 +00:00
Philip Withnall
b95d9d1db6 Merge branch 'g_obj_take_ref' into 'main'
GObject: add g_object_take_ref()

Closes #1112

See merge request GNOME/glib!2146
2021-06-15 11:28:00 +00:00
Simon McVittie
9d2d99efe7 Merge branch '2423-llvm-objcopy' into 'main'
tests: Allow GResource external data tests to use llvm-objcopy

Closes #2423

See merge request GNOME/glib!2154
2021-06-14 16:19:17 +00:00
Simon McVittie
e7ebee5959 Merge branch 'bookmarkfile-test-tmp' into 'main'
tests: Use a temporary file in the bookmarkfile tests

See merge request GNOME/glib!2105
2021-06-14 15:47:42 +00:00
Philip Withnall
838dc04c76 glocalfilemonitor: Avoid a deadlock on finalization
If `g_file_monitor_source_dispatch()` drops the last reference to its
`GLocalFileMonitor`, a deadlock will occur, because disposing the
`GLocalFileMonitor` causes synchronous disposal of the
`GFileMonitorSource`, and hence an attempt to re-lock the already-locked
mutex in the `GFileMonitorSource`.

Fix that by dropping the reference to the `GLocalFileMonitor` after
unlocking.

Diagnosed by Ting-Wei Lan. The bug was originally introduced by me in
commit 592a13b483.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-14 15:09:52 +01:00
Philip Withnall
e522768ef4 tests: Allow GResource external data tests to use llvm-objcopy
Relax the requirement for the test to only be compiled/run under gcc,
since a version of LLVM was released which supports `--add-symbol`.

`objcopy` should be overrideable to be `llvm-objcopy` by using a machine
file as per https://mesonbuild.com/Machine-files.html#binaries.

Suggested and tested by Grigory Vasilyev.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2423
2021-06-14 14:49:59 +01:00
Philip Withnall
b519cf0f3e Merge branch 'wip/fix-docs' into 'main'
docs: Fix annotations for optional arguments

See merge request GNOME/glib!2153
2021-06-11 14:46:25 +00:00
Evangelos Ribeiro Tzaras
708100c0a2 docs: Fix annotations for optional arguments
The length parameter in g_hash_table_get_keys_as_arrays() is optional and
this should be reflected in the gtk-doc annotations.
2021-06-11 15:19:17 +02:00
Allison Ryan Lortie
3764c6730e GObject: add g_object_take_ref()
This works in the same way as g_variant_take_ref(), and for the same
reason.

Updated and Rebased by Nitin Wartkar <nitinwartkar58@gmail.com>

Closes #1112
2021-06-11 18:13:34 +05:30
Philip Withnall
4de3ea4ead subprojects: Add libpcre.wrap
This is from the wrapdb, at version 8.37-2. This version includes
changes needed for the subproject to work correctly in GLib: enabled
Unicode support. Earlier wrap versions won’t work.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #962
2021-06-10 15:32:41 +01:00