Commit Graph

27886 Commits

Author SHA1 Message Date
Amn Alam
7438668696 Update Punjabi translation 2023-08-30 01:55:48 +00:00
Michael Catanzaro
197e6d6f5d Merge branch '3090-resource-uri-malformed' into 'main'
gresourcefile: Fix crash if called with a badly escaped URI

Closes #3090

See merge request GNOME/glib!3554
2023-08-29 15:31:32 +00:00
Philip Withnall
ed03b1f3f6 gresourcefile: Fix crash if called with a badly escaped URI
Return an invalid `GFile` instead, as is the custom for VFS functions.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3090
2023-08-29 11:22:43 +01:00
Philip Withnall
b35e70a701 Merge branch 'ebassi/rst-codegen-fixes' into 'main'
Generate missing docs for out arguments

See merge request GNOME/glib!3553
2023-08-28 17:16:34 +00:00
Emmanuele Bassi
5f8af01b8b Generate RST anchors for methods, signals, and properties
Don't rely on the titles.
2023-08-28 16:59:32 +01:00
Emmanuele Bassi
5f33ae8901 Generate missing docs for out arguments
The reStructuredText generator is missing the documentation blocks for
out arguments.
2023-08-28 16:59:32 +01:00
Philip Withnall
9f6b77d835 gdbusconnection: Add some assertions about required message fields
The fields are fully validated in `validate_headers()` in
`gdbusmessage.c` now, so the connection code should be able to rely on
the required ones being non-`NULL`.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3061
2023-08-28 11:11:37 +01:00
Philip Withnall
eae5c49085 gdbusconnection: Combine two identical variables
`object_path` and `path` were doing exactly the same thing here.

This introduces no functional changes.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-28 11:11:37 +01:00
Philip Withnall
7cca4b1590 gdbusmessage: Validate required headers have the right type
We already validated that the required headers for each type of D-Bus
message were present. However, we didn’t validate that they contained a
variant of the right type. This could lead to functions like
`g_dbus_message_get_path()` returning `NULL` unexpectedly.

This failure could only be hit when using GDBus in peer-to-peer mode, or
with a D-Bus server which didn’t validate the headers itself. The
reference D-Bus server does validate the headers, and doesn’t forward
invalid messages to clients.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3061
2023-08-28 11:11:37 +01:00
Anders Jonsson
ac9bcd1c1d Update Swedish translation 2023-08-27 20:26:13 +00:00
Christian Hergert
eb8a33625e gobject: Separate GWeakRef from GWeakNotify
This patch is based upon Garrett Regier's work from 2015 to provide
some reliability and predictability to how disposal handles weak
reference state.

A primary problem is that GWeakRef and GWeakNotify state is shared and
therefore you cannot rely on GWeakRef status due to a GWeakNotify
calling into second-degree code.

It's important to ensure that both weak pointer locations and GWeakRef
will do the proper thing before user callbacks are executed during
disposal. Otherwise, user callbacks cannot rely on the status of their
weak pointers. That would be mostly okay but becomes an issue when
second degree objects are then disposed before any notification of
dependent object disposal.

Consider objects A and B.

`A` contains a reference to `B` and `B` contains a `GWeakRef` to `A`.
When `A` is disposed, `B` may be disposed as a consequence but has not
yet been notified that `A` has been disposed. It's `GWeakRef` may also
cause liveness issues if `GWeakNotify` on `A` result in tertiary code
running which wants to interact with `B`.

This example is analagous to how `GtkTextView` and `GtkTextBuffer` work
in text editing applications.

To provide application and libraries the ability to handle this using
already existing API, `GWeakRef` is separated into it's own GData quark
so that weak locations and `GWeakRef` are cleared before user code is
executed as a consequence of `GData` cleanup.

# Conflicts:
#	gobject/tests/signals.c
2023-08-25 14:25:47 -07:00
Philip Withnall
fd2d1e829e Merge branch 'fix-async' into 'main'
glib/tests/asyncqueue.c: skip test_async_queue_timed in 2038 or later

See merge request GNOME/glib!3550
2023-08-24 19:45:10 +00:00
Alexander Kanavin
9bdb19b821 glib/tests/asyncqueue.c: skip test_async_queue_timed in 2038 or later 2023-08-24 19:45:09 +00:00
Michael Catanzaro
5216e8c7d5 Merge branch 'fix-tmpfile' into 'main'
glib/gfileutils.c: use 64 bits for value in get_tmp_file()

See merge request GNOME/glib!3547
2023-08-23 17:38:49 +00:00
Alexander Kanavin
285db475ec glib/gfileutils.c: use 64 bits for value in get_tmp_file()
On 32 bit systems 'long' value will overflow in 2038 and become negative.
As it is used to index into letters array, and % operation preserves signs,
data corruption will then occur.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2023-08-23 14:50:41 +02:00
Michael Catanzaro
8754a57d95 Merge branch '3083-option-docs-list' into 'main'
goption: Fix list formatting in documentation comment

Closes #3083

See merge request GNOME/glib!3546
2023-08-21 13:36:58 +00:00
Philip Withnall
8673c3f757 Merge branch 'rybalkin-gregex-jit-stack-overflow-fallback' into 'main'
gregex: if JIT stack limit is reached, fall back to interpretive matching

See merge request GNOME/glib!3545
2023-08-21 10:39:29 +00:00
Aleksei Rybalkin
5921ea112d gregex: if JIT stack limit is reached, fall back to interpretive matching
Helps: #2824
2023-08-21 10:39:27 +00:00
Philip Withnall
22752a51c5 goption: Fix list formatting in documentation comment
Not actually tested, but hopefully this will work.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3083
2023-08-21 11:34:27 +01:00
Philip Withnall
0c1e719bdb Merge branch 'th/use-localtime-r' into 'main'
[th/use-localtime-r] use localtime_r() in g_log_writer_format_fields()

See merge request GNOME/glib!3543
2023-08-21 10:28:16 +00:00
Thomas Haller
84c9d887ee glib: avoid non-reentrant localtime() in g_log_writer_format_fields() 2023-08-21 08:54:31 +02:00
Thomas Haller
471188abdb gdate: add internal helper function _g_localtime() for localtime()/localtime_r()
The point of to be able to call localtime()/localtime_r() from another
place inside glib (without reimplementing the #ifdef).

- also handles failures from localtime_r(). It is documented that it
  might fail, so detect the failure.

- in case of failures of localtime(), still initialize the GDate.
  Previously, we may error out with a g_critical() assertion before.
  However, now that failures from localtime_r() are also caught, I think
  we should make an effort to initialize the GDate to something. It
  either way it not supposed to happen.
2023-08-21 08:53:43 +02:00
Baurzhan Muftakhidinov
5ffc23605c Update Kazakh translation 2023-08-19 07:44:16 +00:00
Philip Withnall
0c63639723 Merge branch 'th/gchildwatch-fail-message' into 'main'
[th/gchildwatch-fail-message] gmain: improve g_warning() for failure in g_child_watch_dispatch()

See merge request GNOME/glib!3542
2023-08-17 23:05:22 +00:00
Thomas Haller
89b55fa9bc gmain: improve g_warning() for failure in g_child_watch_dispatch()
Print the PID, the errno and the pidfd in case of an unexpected failure
in g_child_watch_dispatch().

This is always(?) caused by a bug in the user application. Also hint to
g_child_watch_source_new() documentation for possible causes.

Also use G_PID_FORMAT for printing GPid values.
2023-08-17 19:12:23 +02:00
Michael Catanzaro
95baa8dcc5 Merge branch 'test-subprocess-docs' into 'main'
gtestutils: Mention not ignoring SIGCHLD in g_test_trap_subprocess() docs

See merge request GNOME/glib!3541
2023-08-17 14:30:27 +00:00
Philip Withnall
943972facf Merge branch 'wip/JCWasmx86/gresource-schema' into 'main'
gio: Add gresource.dtd

See merge request GNOME/glib!3540
2023-08-17 14:03:39 +00:00
Philip Withnall
15022cab15 gtestutils: Mention not ignoring SIGCHLD in g_test_trap_subprocess() docs
Prompted by #3071, this clarifies that `g_test_trap_subprocess()` uses
`g_child_watch_source_new()` internally, so it will not work if any of
the preconditions for using that API are not met. In particular, if
`SIGCHLD` is ignored, things will break.

This documentation is not meant to be an API guarantee which constrains
the implementation of `g_test_trap_subprocess()` in future, just a tip
to people currently using the API.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3071
2023-08-17 14:59:28 +01:00
JCWasmx86
0b4a9db4a7 gio: Add dtdsdir pointing to the directory of gresource.xml
This allows third party projects to look up the location of installed
DTDs without having to hard-code it.
2023-08-17 14:26:34 +01:00
JCWasmx86
f10bb13314 gio: Add gresource.dtd
This allows linting of .gresource.xml files e.g. in the editor.
2023-08-17 14:25:53 +01:00
Michael Catanzaro
77a56b58ed Merge branch 'o-nonblock-more' into 'main'
glib-unix: Accept O_CLOEXEC as well as FD_CLOEXEC in g_unix_open_pipe()

See merge request GNOME/glib!3538
2023-08-16 18:13:13 +00:00
Philip Withnall
c91917b1be Merge branch 'wip/smcv/o-nonblock' into 'main'
glib-unix: Clean up use of O_NONBLOCK

See merge request GNOME/glib!3459
2023-08-16 17:30:59 +00:00
Philip Withnall
2838b77558 Merge branch 'meson_setup' into 'main'
Use 'meson setup' to configure

See merge request GNOME/glib!3535
2023-08-16 13:37:16 +00:00
Philip Withnall
07c4b6c68e glib: Pass O_CLOEXEC rather than FD_CLOEXEC to g_unix_open_pipe()
See the previous commit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-16 14:31:40 +01:00
Philip Withnall
d0dc7171d6 glib-unix: Accept O_CLOEXEC as well as FD_CLOEXEC in g_unix_open_pipe()
This is one step towards rectifying the mistake of using `FD_CLOEXEC` in
the first place. Eventually we may deprecate support for `FD_CLOEXEC`,
as the `O_*` flags better match the underlying `pipe()` API.

See discussion on
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3459#note_1779264

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-16 14:31:40 +01:00
Philip Withnall
954b15218c Merge branch 'mcatanzaro/l10n-time' into 'main'
gsettingsschema: fix l10n=time attribute

Closes #2575

See merge request GNOME/glib!2422
2023-08-16 13:24:18 +00:00
Simon McVittie
de6cebb5f6 glib-unix: Don't fall back from O_NONBLOCK to O_NDELAY
Since 5c65437d "glib-unix: Add O_NONBLOCK support to g_unix_open_pipe()"
we have been using O_NONBLOCK unconditionally, so we might as well drop
the fallback here as well. This commit should be reverted if someone
reports a significant/supported platform that genuinely doesn't have
O_NONBLOCK.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-16 14:02:35 +01:00
Simon McVittie
40508b35b9 glib-unix: Assert that O_NONBLOCK and FD_CLOEXEC are numerically distinct
Since 5c65437d "glib-unix: Add O_NONBLOCK support to g_unix_open_pipe()"
we have effectively been assuming that these two flags are
distinguishable. If that's an assumption we want to make, we should make
it a static assertion, so that GLib will fail to compile on platforms
where it isn't true.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-16 14:02:35 +01:00
Emmanuele Bassi
9723c5595c ci: Use meson compile rather than bare ninja
This makes it more consistent with `meson setup` in the rest of the
file.
2023-08-16 13:07:05 +01:00
René de Hesselle
0c73ff3a08 meson: Use 'meson setup' to configure
This removes a deprecation warning when using 'meson' without 'setup'.
2023-08-16 13:06:40 +01:00
Philip Withnall
4a60527f2e Merge branch 'preserve-doc-indent' into 'main'
gdbus-codegen: preserve relative indentation in doc comments

Closes #3032

See merge request GNOME/glib!3536
2023-08-16 11:48:27 +00:00
Philip Withnall
9b15842ec1 Merge branch 'rybalkin-gregex-jit-increase-stack-size' into 'main'
gregex: set default max stack size for PCRE2 JIT compiler to 512KiB

See merge request GNOME/glib!3530
2023-08-15 13:26:43 +00:00
André
9a6ca0ef75
gdbus-codegen: preserve relative indentation in doc comments
This commit also changes the generators for rst, xml and dockbook
to preserve indentation.

Closes #3032
2023-08-14 23:46:09 -03:00
Danial Behzadi
006e102e04 Update Persian translation 2023-08-14 22:57:35 +00:00
Aleksei Rybalkin
c3ff5b8eb3 gregex: set default max stack size for PCRE2 JIT compiler to 512KiB
Previous default used was 32KiB (the library default) which caused some
complex patterns to fail, see #2824. The memory will not be allocated
unless used.
2023-08-14 20:43:15 +02:00
Aleksei Rybalkin
842a105464 gregex: remove redundant call to enable_jit_with_match_options
There is no point to enable jit in g_regex_new, since JIT will be only
used when we do a first match, and at that point
enable_jit_with_match_options will be called again already and will
update the options set in g_regex_new. Instead just run it at first
match for the first time, to the same end result.
2023-08-14 20:32:48 +02:00
Emmanuele Bassi
a7c34b431b Merge branch 'tree-asserts' into 'main'
tests: Use g_assert_*() rather than g_assert() in tree tests

See merge request GNOME/glib!3527
2023-08-14 12:45:21 +00:00
Philip Withnall
73efc47ddd Merge branch 'schedules-pages-again' into 'main'
ci: Further fix to pages CI job

See merge request GNOME/glib!3534
2023-08-14 10:51:14 +00:00
Philip Withnall
84f45cd694 ci: Further fix to pages CI job
Follow-up to e234a4496e to remove the old
`only: main`, which was overriding the changes from that commit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-14 11:00:15 +01:00
Philip Withnall
9309b8d68f Merge branch 'ci-pages-schedules' into 'main'
ci: Only run pages CI job on scheduled job runs

See merge request GNOME/glib!3533
2023-08-14 09:48:14 +00:00