Commit Graph

26033 Commits

Author SHA1 Message Date
Aleksei Rybalkin
bcd8cb3e14 gregex: use G_REGEX_OPTIMIZE flag to enable JIT compilation
Since we ported gregex to pcre2, the JIT compiler is now available to be
used. Let's undeprecate G_REGEX_OPTIMIZE flag to control whether the JIT
compilation is requested, since using JIT is itself an optimization.
See [1] for details on its implementation in pcre2.

[1] http://pcre.org/current/doc/html/pcre2jit.html

Fixes: #566
2022-07-20 20:48:17 +00:00
Philip Withnall
34e5bb8b43 Merge branch 'gregex-match-info-leak-fix' into 'main'
gregex: Free match info if offset matching recalc failed

See merge request GNOME/glib!2827
2022-07-20 13:56:23 +00:00
Philip Withnall
8d3dac8f83 Merge branch 'wip/smcv/gdbus-sasl' into 'main'
GDBus: improve interoperability of SASL handshake

See merge request GNOME/glib!2826
2022-07-20 13:01:49 +00:00
Marco Trevisan (Treviño)
6c93ac876f gregex: Free match info if offset matching recalc failed
It's not probably ever happening in practice, but coverity found it and
it's easy enough to fix it.

Coverity CID: #1490730
2022-07-20 06:32:30 +02:00
Simon McVittie
6abda14dc9 Merge branch 'wip/smcv/no-such-device' into 'main'
gioenums: G_IO_ERROR_NO_SUCH_DEVICE is new in 2.74

See merge request GNOME/glib!2825
2022-07-20 04:28:36 +00:00
Simon McVittie
0c24039874 tests: Add a test for GDBusServer with various simulated clients
Instead of using a GDBusConnection, this does the handshake at a lower
level using specific strings in the SASL handshake, to verify that we
will interoperate with various clients including sd-bus, libdbus and
older versions of GDBus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 19:39:41 +01:00
Simon McVittie
3f532af65c gdbusauth: Represent empty data block as DATA\r\n, with no space
This is an interoperability fix. The reference implementation of D-Bus
treats "DATA\r\n" as equivalent to "DATA \r\n", but sd-bus does not,
and only accepts the former.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 17:53:40 +01:00
Giuseppe Scrivano
b51e3ab09e GDBusServer: Accept empty authorization identity for EXTERNAL mechanism
RFC 4422 appendix A defines the empty authorization identity to mean
the identity that the server associated with its authentication
credentials. In this case, this means whatever uid is in the
GCredentials object.

In particular, this means that clients in a different Linux user
namespace can authenticate against our server and will be authorized
as the version of their uid that is visible in the server's namespace,
even if the corresponding numeric uid returned by geteuid() in the
client's namespace was different. systemd's sd-bus has relied on this
since commit
1ed4723d38.

[Originally part of a larger commit; commit message added by smcv]

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 17:53:32 +01:00
Giuseppe Scrivano
a7d2e727ee GDBusServer: If no initial response for EXTERNAL, send a challenge
Sending an "initial response" along with the AUTH command is meant
to be an optional optimization, and clients are allowed to omit it.
We must reply with our initial challenge, which in the case of EXTERNAL
is an empty string: the client responds to that with the authorization
identity.

If we do not reply to the AUTH command, then the client will wait
forever for our reply, while we wait forever for the reply that we
expect the client to send, resulting in deadlock.

D-Bus does not have a way to distinguish between an empty initial
response and the absence of an initial response, so clients that want
to use an empty authorization identity, such as systed's sd-bus,
cannot use the initial-response optimization and will fail to connect
to a GDBusServer that does not have this change.

[Originally part of a larger commit; commit message added by smcv.]

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 16:26:24 +01:00
Giuseppe Scrivano
764f071909 gdbusauth: empty DATA does not need a trailing space
This is an interoperability fix. If the line is exactly "DATA\r\n",
the reference implementation of D-Bus treats this as equivalent to
"DATA \r\n", meaning the data block consists of zero hex-encoded bytes.
In practice, D-Bus clients send empty data blocks as "DATA\r\n", and
in fact sd-bus only accepts that, rejecting "DATA \r\n".

[Originally part of a larger commit; commit message added by smcv]

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 16:11:20 +01:00
Simon McVittie
937f9a61cd gioenums: G_IO_ERROR_NO_SUCH_DEVICE is new in 2.74
This attribute will produce "deprecation" warnings when using it in
code that does not want dependencies on newer GLib versions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 12:02:12 +01:00
Danial Behzadi
edcedd86d7 Update Persian translation 2022-07-17 19:42:47 +00:00
Danial Behzadi
37efb8c229 Update Persian translation 2022-07-16 14:21:04 +00:00
Philip Withnall
32e1c2f91a Merge branch 'dist-job-fix' into 'main'
ci: Setup submodules and subprojects before building on dist

See merge request GNOME/glib!2812
2022-07-15 22:09:42 +00:00
Philip Withnall
b33ba73532 Merge branch 'gsignal-threading-cleanup' into 'main'
gsignal: Perform signal unlocked handlers block, unblock and disconnect ops

See merge request GNOME/glib!2823
2022-07-15 21:36:28 +00:00
Philip Withnall
c3a80a7142 Merge branch 'non-registered-extension-point' into 'main'
Add missing extension point register for various settings backends

See merge request GNOME/glib!2813
2022-07-15 21:25:58 +00:00
Philip Withnall
bdaf1ffa67 Merge branch 'c-only' into 'main'
meson: fix build without cpp toolchain

See merge request GNOME/glib!2822
2022-07-15 21:23:03 +00:00
Ryan Hope
7c4e6032c6 Add tests for GMemorySettingsBackend and GNullSettingsBackend 2022-07-15 22:07:03 +02:00
Ryan Hope
924da751c2 gio: Ensure extension points are registered when creating Settings backends
Add missing call to _g_io_modules_ensure_extension_points_registered() to
GRegistryBackend, GNullSettingsBackend, and GNextstepSettingsBackend
2022-07-15 21:36:09 +02:00
Ryan Hope
04255e4565 Add missing extension point register for for GMemorySettingsBackend
Using GMemorySettingsBackend before any other GSettingsBackend would
cause the following error: "Tried to implement non-registered extension
point gsettings-backend". This is due to a missing call to
_g_io_modules_ensure_extension_points_registered() in the GMemorySettingsBackend
type definition which registers the gsettings-backend extension point.
2022-07-15 21:36:03 +02:00
James Hilliard
d0b9ebbaac meson: fix build without cpp toolchain
We don't need a cpp toolchain for building glib so lets just
automatically disable tests requiring one when not available.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-07-15 12:58:41 -06:00
Marco Trevisan (Treviño)
42d52033db gsignal: Do not try to lookup the signal id and work on unlocked node
In g_signal_parse_name we were looking up for the signal from the name
keeping the mutex locked, but we then retrieved and checked the node
data without keeping the lock, so with another thread potentially
changing that.
2022-07-15 16:09:14 +02:00
Marco Trevisan (Treviño)
ae14f3219a gsignal: Perform signal unlocked handlers block, unblock and disconnect ops
We used to perform unneeded lock/unlock dances to perform block, unblock
and disconnect actions, and these were potentially unsafe because we
might have looped in data that could be potentially be changed by other
threads.

We could have also done the same by saving the handlers ids in a
temporary array and eventually remove them, but I don't see a reason for
that since we can just keep all locked without the risk of creating
deadlocks.

Coverity CID: #1474757, #1474771, #1474429
2022-07-15 16:05:35 +02:00
Philip Withnall
28c07dc966 Merge branch 'regex-do-not-assert-on-compile-error' into 'main'
gregex: Ensure we translate the errcode without asserting on G_REGEX_ERROR_COMPILE

Closes #2694

See merge request GNOME/glib!2821
2022-07-15 11:26:55 +00:00
Hugo Carvalho
28fd2e4e67 Update Portuguese translation 2022-07-15 11:20:50 +00:00
Marco Trevisan (Treviño)
c05d09044f gregex: Ensure we translate the errcode without asserting on G_REGEX_ERROR_COMPILE
Since commit 8d5a44dc in order to ensure that we were setting the errcode in
translate_compile_error(), we did an assert checking whether it was a
valid value, but we assumed that 0 was not a valid error, while it is as
it's the generic G_REGEX_ERROR_COMPILE.

So, set errcode and errmsg to invalid values before translating and
ensure we've change them.

Fixes: #2694
2022-07-15 01:46:11 +02:00
Yuri Chornoivan
c1eb93d2a2 Update Ukrainian translation 2022-07-14 13:31:13 +00:00
Philip Withnall
e395ff2e8b Merge branch 'rybalkin-gregex-fix-translation-extraction' into 'main'
gregex: use %s format specifier for localized error message

See merge request GNOME/glib!2814
2022-07-14 13:14:31 +00:00
Aleksei Rybalkin
5cd94a0982 gregex: use %s format specifier for localized error message 2022-07-14 13:14:31 +00:00
Yosef Or Boczko
0be4611726 Update Hebrew translation 2022-07-14 11:02:05 +00:00
Philip Withnall
8b1e8ecb54 goption: Slightly improve the documentation for G_OPTION_FLAG_REVERSE
None of the documentation actually mentioned booleans, which would be a
useful keyword to include for context.

Inspired by https://stackoverflow.com/questions/72958500/what-is-the-sense-of-a-command-line-option

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-13 15:58:24 +01:00
Hugo Carvalho
4c62849e2e Update Portuguese translation 2022-07-13 12:16:27 +00:00
Philip Withnall
42172b651d Merge branch 'musl' into 'main'
gmain: define non-posix symbols

Closes #2692

See merge request GNOME/glib!2816
2022-07-13 09:33:22 +00:00
Philip Withnall
0c484b9a28 Merge branch 'giomodule-init-once' into 'main'
giomodule: Use g_once_init_enter/leave to register extensions and load dirs

See merge request GNOME/glib!2815
2022-07-13 09:17:12 +00:00
Owen Rafferty
871e570867
gmain: define non-posix symbols 2022-07-12 20:03:56 -05:00
Marco Trevisan (Treviño)
399f46f8bf giomodule: Use g_once_init_enter/leave to register extensions and load dirs
There's no much change in behavior, but let's take advantages of the tools
we already have to handle these cases.
2022-07-13 00:47:31 +02:00
Danial Behzadi
a2f8dca009 Update Persian translation 2022-07-12 20:43:29 +00:00
Marco Trevisan (Treviño)
99c2b4e499 ci: Setup submodules and subprojects before building on dist
Also handle a permission issue.
2022-07-12 20:25:04 +02:00
Marco Trevisan (Treviño)
f622a4ed53
2.73.2
Co-authored-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marco Trevisan (Treviño) <marco@ubuntu.com>
2022-07-12 18:32:22 +02:00
Yuri Chornoivan
2c8948c3fa Update Ukrainian translation 2022-07-12 16:26:03 +00:00
Marco Trevisan
c752b63143 Merge branch 'wait-for-async-uri-handler-called' into 'main'
gio/tests/desktop-app-info: Wait until the callback is called

See merge request GNOME/glib!2809
2022-07-12 15:46:14 +00:00
Philip Withnall
b8b037c428 Merge branch '2687-socket-cancellable' into 'main'
gsocketclient: Fix passing NULL to g_task_get_cancellable()

Closes #2687

See merge request GNOME/glib!2808
2022-07-12 15:38:43 +00:00
Marco Trevisan (Treviño)
ecaa5b5b7a gio/tests/desktop-app-info: Wait until the callback is called
The test was flacky because we were only relying on the presence of a
file, while the callback could have not been called yet, while ensure
for both assumptions to be true before stop iterating the loop.
2022-07-12 17:33:15 +02:00
Philip Withnall
e2639ce56e gsocketclient: Fix passing NULL to g_task_get_cancellable()
Fix a regression from commit abddb42d14, where it could pass `NULL` to
`g_task_get_cancellable()`, triggering a critical warning. This could
happen because the lifetime of `data->task` is not as long as the
lifetime of the `ConnectionAttempt`, but the code assumed it was.

Fix the problem by keeping a strong ref to that `GCancellable` around
until the `ConnectionAttempt` is finished being destroyed.

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

Fixes: #2687
2022-07-12 16:07:23 +01:00
Marco Trevisan
df239b97fb Merge branch 'wip/pwithnall/wpointer-sign' into 'main'
ci: Specify -Wno-overlength-strings on macOS
gstdio: Do not pass wrong pointer types to FILETIME to unix conversion
build: Specify -Werror=pointer-sign

See merge request GNOME/glib!2807
2022-07-12 14:25:53 +00:00
Philip Withnall
4353813058 build: Specify -Werror=pointer-sign
This can catch the wrong pointer being passed to a function argument (in
some cases), with few false positives.

Spotted while testing !2529.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-12 15:55:59 +02:00
Marco Trevisan (Treviño)
f0e98a1923 gstdio: Do not pass wrong pointer types to FILETIME to unix conversion 2022-07-12 15:55:59 +02:00
Philip Withnall
e6af2d3662 ci: Specify -Wno-overlength-strings on macOS
This disables the following warning, which was causing CI failures on
macOS when building the libpcre2 subproject:
```
../subprojects/pcre2-10.40/src/pcre2_error.c:66:3: error: string literal of length 4380 exceeds maximum length 4095 that ISO C99 compilers are required to support [-Werror,-Woverlength-strings]
```

We don’t want to explicitly rely on using overlength strings in GLib,
which is why this change is a `CFLAGS` in the CI configuration, rather
than setting a project-level argument in `meson.build`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-12 14:16:23 +01:00
Philip Withnall
e19df710d2 Merge branch 'scheduler-warning-atomic-set' into 'main'
gthread-posix: Do not do unguarded and non-atomic assignment of an atomic

See merge request GNOME/glib!2805
2022-07-12 12:52:21 +00:00
Marco Trevisan (Treviño)
39ecb71452 gthread-posix: Do not do unguarded and non-atomic assignment of an atomic
We ended up always skipping showing the scheduler settings errors after
the first call, while we were already setting such variable atomically
in case it needed to.

Related to: #1672
2022-07-12 14:30:20 +02:00