We can't easily use g_autofd with g_unix_open_pipe, because its
parameter is an array of two fds that both need closing. Add an inline
convenience wrapper providing the obvious semantics.
Signed-off-by: Simon McVittie <smcv@collabora.com>
g_clear_fd() is documented to be async-signal safe whenever the
fd is either negative or valid (which it should be here) and the error
is NULL (which it always is here).
Signed-off-by: Simon McVittie <smcv@collabora.com>
It's not very likely, but there is a small chance that an
incoming signal could disturb the non-blocking read calls in
g_wakeup_acknowledge, leading to a subsequent spurious wake up.
This commit addresses the problem by doing the usual EINTR
loop (which is already present on the write side incidentally)
Previously, this would loop as long as read() got the expected number of
bytes back, which is 8. That means every successful read() of the eventfd
would perform an additional syscall() as a followup.
This is not ideal because eventfd (unless used as an EFD_SEMAPHORE) will
reset the counter as part of the read(). So that means that we either do
an additional throw-away syscall() or potentially race against a producer
generating new events before this change.
Currently the GSourceList has it's own allocation plus a secondary
allocation for the GList which contains it (from GMainContext). Not only
are these a pointer chase, but they are on separate cachelines too. Without
changing the code much we can at least keep things on the same cacheline
so that the pointer chase matters less.
Since the GList becomes embedded in the GSourceList you can use a
g_queue_unlink() directly removing the link without traversing the GList
like was done before.
Furthermore, we can simplify some code with g_queue_push_tail_link()
instead of some extra branching.
I'm not aware of any platforms where this is a problem in practice, but
it's definitely nonportable and doesn't hurt to document it.
I wonder about CHERI....
This should not result in any functional changes, but will eventually
allow glib to be functional on CHERI-enabled systems such as Morello.
Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
These functions can be used to initalize pointer-type variables rather
than a gsize. This is required to support CHERI-enabled platforms where
gsize cannot be used to store pointers. Follow-up changes will migrate
the uses of g_once_init that store pointers to the new API
Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
One test key was serving two purposes, which meant tests for it couldn’t
be separated out. It was testing escape-at-end-of-line and also
invalid-escape.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #3098
This reverts commit 4a96727642.
It was a temporary workaround to prevent disruption to apps late on in
the 2.78 cycle. Since we’re now early in the 2.80 cycle, let’s revert
the workaround and allow apps more time to fix their error handling for
`GKeyFile`.
Fixes: #3098
Commit 0b114b2687 accidentally made the
tests only pass on systems running in a UTC timezone, as it checked the
local timezone `%Z` format against `UTC`.
This happens to pass on all the GLib CI runners except the macOS one,
which is running under CET.
Make the formatting tests timezone-independent by running them with UTC
datetimes. There’s already a separate test for checking that `%Z` works
correctly in a non-UTC timezone (`test_z`).
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3611#note_1859208
It’s not actually needed on any platform, and causes compilation
problems on platforms where it’s not available.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #3111
The Comment field provides a user-visible description of the app,
which usually contains generic words ("and", "or", "not", "is", ...)
that add noise when used for search.
It made some sense to match against the field as a fallback for
Keywords, before that key was well established. However that key
has been around for years now, so hopefully every app where additional
terms are helpful uses it by now.
With that, the downside of added noise outweighs the benefit, so
it's time to stop matching on comments.