Commit Graph

32341 Commits

Author SHA1 Message Date
Philip Chimento
c247e1c20b gmacros: Add G_GNUC_FLAG_ENUM
This expands to __attribute__((flag_enum)) if available. It is useful when
using clang-tidy to do static analysis, which will warn about code like
(GParamFlags)(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE).
2025-11-07 22:44:35 -08:00
Philip Withnall
837a6eca8e 2.87.0
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.87.0
2025-11-03 12:42:10 +00:00
Philip Withnall
17d8a9adfa Merge branch 'mcatanzaro/ywh-131' into 'main'
gunixmounts: fix out of bounds write in AIX mount table parser

See merge request GNOME/glib!4895
2025-11-03 11:39:57 +00:00
Philip Withnall
2f345da831 gunixmounts: fix another out of bounds write in AIX mount table parser
Along the same lines as the previous commit, as suggested by Marco
Trevisan.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-11-03 11:16:45 +00:00
Marco Trevisan
2f40de8802 Merge branch 'msvc-pcre-tests' into 'main'
Re-enable PCRE2 tests for 32-bit Visual Studio builds

See merge request GNOME/glib!4897
2025-11-02 14:33:15 +01:00
Philip Withnall
eb806dd5bb Merge branch 'win32-thread-priority' into 'main'
gthread-win32: Ignore error when setting thread priority

See merge request GNOME/glib!4894
2025-11-02 12:19:55 +00:00
Philip Withnall
9081ee475b Merge branch 'wip/gdbus-codegen-hooks' into 'main'
gdbus-codegen: Support extensions and changing the GDBusInterfaceSkeleton type to inherit from

See merge request GNOME/glib!4812
2025-11-02 11:35:06 +00:00
Sebastian Wick
3287ba22a1 gdbusinterfaceskeleton: Use a vfunc for method dispatching
This allows libdex to use a GDBusInterfaceSkeleton subtype to dispatch
method calls in fibers.
2025-11-02 11:18:37 +00:00
Sebastian Wick
e2bc9c1aba tests/codegen: Add tests for the new extension system
This makes sure that extensions can generate code at the expected
places, and change the GDBusInterfaceSkeleton subtype that generated
skeletons derive from.
2025-11-02 11:18:37 +00:00
Sebastian Wick
47a109c241 gdbus-codegen: Allow extensions to override the InterfaceSkeleton type
The libdex gdbus-codegen extension will use a GDBusInterfaceSkeleton
subtype to dispatch method calls in a fiber.
2025-11-02 11:18:37 +00:00
Sebastian Wick
4405fe5fc8 gdbus-codegen: Add an extension system which allows hooking codegen
The extension points are chosen by what libdex needs to generate future
based method calls.
2025-11-02 11:18:37 +00:00
Sebastian Wick
07ba38449e gdbus-codegen: Add a few more sync/async/finish comments 2025-11-02 11:18:37 +00:00
Sebastian Wick
df0315d125 gdbus-codegen: Add name_upper to Methods and ns_lower to Interfaces
We already have those variants on other classes, and they will become
useful in the libdex codegen extension.
2025-11-02 11:18:37 +00:00
Sebastian Wick
1b9ea4db35 gdbus-codegen: Add copy_func to Args
This allows us to create a copy of an argument without going through
GValue. The codegen here does not have any use for it, but we will add
an extension system in a later commit. The libdex codegen extension will
make use of it to define a boxed type for the method return values.
2025-11-02 11:18:37 +00:00
Sebastian Wick
ad42abd311 gdbus-codegen: Use the non-pointer type for ctype_out
The out type can be different from the in types in their qualifiers and
thus are not always simply a reference to the in type. However, the out
types used to include the reference instead of the "base" type because
the code generator always used them in places where we actually needed a
reference to the out type (e.g. as out params).

For example, the codegen here generates:

    gboolean dex_dbus_ping_pong_call_ping_sync (
        DexDbusPingPong *proxy,
        const gchar *arg_name,
        gchar ** out_pong,
        GCancellable *cancellable,
        GError **error);

Where `gchar **` is the out type. If we want to codegen a function which
returns the out params in a struct, it would need to look like this:

    typedef struct _DexDbusPingPongPingResult
    {
      gchar * pong;
    } DexDbusPingPongPingResult;

Where neither the out type `gchar **` nor the in type `const gchar *` is
appropriate.

This changes the ctype_out to be the base type, and makes the codegen
add the reference explicitly.
2025-11-02 11:18:37 +00:00
Seungha Yang
5c981e74a6 gthread-win32: Ignore error when setting thread priority
Contrary to MSDN documentation, GetThreadPriority() may return
undocumented priority values that SetThreadPriority() cannot accept.
This can happen, for example, when a high-priority process uses
MMCSS to modify thread priority levels.
Since failure to update thread priority is not critical and users
can adjust it later, do not treat such failures as errors
2025-11-01 00:18:33 +09:00
Michael Catanzaro
051273272d Merge branch 'ci-file-tokens-fixup' into 'main'
ci: Actually use token file for the issue bot

See merge request GNOME/glib!4896
2025-10-31 10:05:22 -05:00
Philip Withnall
d7edf567a5 Revert "CI: Skip PCRE2 tests for 32-bit Visual Studio builds"
This reverts commit 6c06792f00.

We now use PCRE 10.46 as a subproject, so the test issues on 32-bit x86
builds with MSVC should now be working again.
2025-10-31 14:28:01 +00:00
Philip Withnall
debb95720c Merge branch 'gdbuserver-inusepaths' into 'main'
gdbusserver: retry binding to unix addresses only when possible

Closes #2949

See merge request GNOME/glib!4891
2025-10-31 12:59:01 +00:00
Marco Trevisan (Treviño)
41a5228ee6 ci: Actually use token file when starting the issue bot
The issue bot has an entry-point, so it launches the tool by default and
that would fail as per the missing env variable:

  2025/10/30 17:57:43 unable to create GitLab client(s): please configure
  ISSUE_BOT_API_TOKEN environment variable (unable to find environment
  variable: ISSUE_BOT_API_TOKEN)

So, go manual instead for real for now.

See: https://gitlab.com/gitlab-org/distribution/issue-bot/-/issues/26
Related: https://gitlab.com/gitlab-org/distribution/issue-bot/-/merge_requests/27
2025-10-31 00:50:54 +01:00
Michael Catanzaro
4156f37a90 gunixmounts: fix out of bounds write in AIX mount table parser
A mount table is inherently trusted, so this isn't really a security
issue, but let's not write out of bounds. If anybody is still using GLib
on AIX, then you're welcome.

Discovery and patch credit: mhzcyber - Mohammad Hussam Alzeyyat

(I, Michael, only wrote this commit message and adjusted the
whitespace.)
2025-10-30 11:49:28 -05:00
Michael Catanzaro
6e05ef5e0a Merge branch 'ci-file-tokens' into 'main'
ci: Use CI/CD file variable tokens for secrets

See merge request GNOME/glib!4893
2025-10-30 10:33:53 -05:00
Marco Trevisan
9144ee6df5 Merge branch 'wip/chergert/RFC-1123' into 'main'
glib/gconvert: allow domain names starting with digit

Closes #3523 and chergert/ptyxis#490

See merge request GNOME/glib!4892
2025-10-30 04:48:11 +01:00
Marco Trevisan (Treviño)
bba1f8ac03 ci: Use CI/CD file variable tokens for secrets
We were leaking some tokens in artifacts, those tokens have been
invalidated and re-generated, but starting from now let's use file
tokens instead
2025-10-30 03:12:29 +01:00
Christian Hergert
de45be2674 glib/gconvert: allow hostnames with . in it
Continues on the fix for #3523 which allows for . to be used in a domain
label.

Fixes: chergert/ptyxis#490
Related: #3523

Signed-off-by: Christian Hergert <chergert@redhat.com>
2025-10-29 14:45:47 -07:00
Christian Hergert
bb2b668db6 glib/gconvert: allow domain names starting with digit
This previous behavior violates RFC-1123 which updated the original
RFC-952.

Patch originally from Ulrich Drepper.

Fixes: #3523

Signed-off-by: Christian Hergert <chergert@redhat.com>
2025-10-29 14:37:57 -07:00
André Barnabá Silva
dcf716945f gdbusserver: retry binding to unix addresses only when possible
This adds the condition that a new unix address is tried only when there
is enough space to append random character(s) before the address reach
the length of UNIX_PATH_MAX.

Before this change, creating a GDBusServer with unix addresses longer
than UNIX_PATH_MAX that existed in the filesystem would never return. A
test that expects G_IO_ERROR_ADDRESS_IN_USE in such scenario was added.
2025-10-29 03:23:01 -03:00
Philip Withnall
a4962ca460 Merge branch 'g_unix_fd_query_path' into 'main'
glib-unix: Add Solaris implementation of g_unix_fd_query_path

See merge request GNOME/glib!4887
2025-10-28 00:09:52 +00:00
Philip Withnall
9249c40d77 Merge branch 'scan-build-fixes' into 'main'
Various scan-build fixes

Closes #3805

See merge request GNOME/glib!4875
2025-10-27 23:17:25 +00:00
Philip Withnall
85e4c53a8c Merge branch 'home_trailing_slash' into 'main'
gutils: Strip all trailing slashes

Closes #3811

See merge request GNOME/glib!4886
2025-10-27 22:55:39 +00:00
Philip Withnall
bfc7acbc88 Merge branch 'sysinfo' into 'main'
Fix `g_memory_monitor_base_query_mem_ratio` on Solaris

See merge request GNOME/glib!4860
2025-10-27 22:09:19 +00:00
Tobias Stoeckmann
cb3e9fe740 gutils: Strip all trailing slashes
The code stripped all but the first trailing slash in order to handle
the absolute root path "/". This breaks the removal of trailing slashes
for paths starting with $HOME, though.

Fix the logic to remove all trailing slashes if $HOME is encountered.

Closes #3811
2025-10-27 21:36:59 +00:00
Philip Withnall
4481a217c4 gdump: Handle feof() and ferror() separately
The return value from `fread()` doesn’t actually indicate whether the
read failed due to EOF or due to a read error.

Rework the code so that errors are reported correctly, EOF is handled
silently, and as a byproduct, blank lines in the input file are ignored
and skipped over.

Spotted by scan-build.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-27 21:34:08 +00:00
Philip Withnall
73514ed284 grand: Port /dev/urandom code from fread() to read()
Error handling in `fread()` is too complex, and the code explicitly
disables the buffering feature of `FILE`, so there’s little point in
using it.

Instead, use `open()`/`read()` directly. This avoids any buffering
issues, and gives us use of `errno` to check errors. `ferror()` doesn’t
give us any more information than “there was an error”.

This fixes an issue flagged by scan-build: that a failure in the first
`fread()` loop iteration would leave the `FILE` in an undefined state
(in particular, an undefined seek position) which would mess up the next
iteration. Since `ferror()` couldn’t actually tell us what the error was
(was it `EINTR`?) and `errno` is not guaranteed to be set by `fread()`,
the whole approach was doomed.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-27 21:34:01 +00:00
Philip Withnall
4937534257 glocalfileoutputstream: Fix error handling for a corner case
If asked to replace a file (i.e. effectively delete and re-create it)
which is a symlink, in a read-only directory, the code would end up
trying to do operations on an invalid `fd`. This was masked when asked
to create a backup, as creating the backup in the read-only
directory would error out just in time.

Make the code a bit more robust in this situation, and add some unit
tests.

Spotted by scan-build.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-27 21:33:54 +00:00
Philip Withnall
f1eeef3777 gspawn: Error out early if a target FD is invalid
Rather than passing it to `dup2()`, which scan-build thinks could cause
problems (I would have thought `dup2()` would just return `EBADF`, but
perhaps some implementations are buggy?).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-27 21:33:34 +00:00
Alan Coopersmith
ccb0954336 glib-unix: Add Solaris implementation of g_unix_fd_query_path
Provide implementation of !4876 for Solaris & illumos systems

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-10-27 21:31:33 +00:00
Alan Coopersmith
db165063f0 gio: add fallback implementation of g_memory_monitor_base_query_mem_ratio
Fallback for non-Linux systems that support the _SC_PHYS_PAGES and
_SC_AVPHYS_PAGES sysconf selectors, such as Solaris & OpenBSD.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-10-27 21:28:59 +00:00
Alan Coopersmith
80b1e3843f build: avoid sysinfo() on Solaris
Solaris inherited the SVR4 sysinfo() function, which takes a different
number of arguments from Linux, and provides information such as host
name and OS version, but not information on free or total memory.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-10-27 21:28:59 +00:00
Philip Withnall
afdf386580 Merge branch 'handle-regex-missing-number-terminator' into 'main'
gregex: Handle PCRE2_ERROR_MISSING_NUMBER_TERMINATOR if defined

Closes #3809

See merge request GNOME/glib!4884
2025-10-27 21:20:40 +00:00
Marco Trevisan (Treviño)
404aa57553 gregex: Add translatable message for PCRE2_ERROR_MISSING_NUMBER_TERMINATOR 2025-10-27 16:49:48 +01:00
Marco Trevisan (Treviño)
3bfe253c51 tests/regex: Add the error messages to tests
It can be useful for debugging purposes
2025-10-27 16:49:48 +01:00
Marco Trevisan (Treviño)
79f883aafb gregex: Handle PCRE2_ERROR_MISSING_NUMBER_TERMINATOR if defined
When the error is defined in a new enough PCRE2 we should handle it.

However let's not define an error message for this in this commit (just
let's use the old one that is generic enough), so that it can be backported
to stable versions without having to require new translations.

Closes: #3809
2025-10-27 16:49:48 +01:00
Nick Wilson
ec80449b1a glib/tests/regex: Add a future-proof test case for missing back reference
This test applies to both old and newer versions of PCRE2 where
back reference error has now increased the granularity and is referred
as PCRE2_ERROR_MISSING_NUMBER_TERMINATOR instead.

Co-Authored-By: Marco Trevisan <mail@3v1n0.net>
2025-10-27 16:48:46 +01:00
Philip Withnall
e0818cd12c Merge branch 'markup-byte-pos' into 'main'
Add g_markup_parse_context_get_offset

See merge request GNOME/glib!4879
2025-10-23 06:19:52 +00:00
Matthias Clasen
ea848032c2 Add g_markup_parse_context_get_offset
This is a small, helpful api that helps for finding error
locations in xml files, along the same lines as
g_markup_parse_context_get_position.
2025-10-22 15:24:10 -04:00
Philip Withnall
29e9549e2a Merge branch 'ug-translation' into 'main'
Update Uyghur translation

Closes #3808

See merge request GNOME/glib!4882
2025-10-22 13:45:26 +00:00
Philip Withnall
3b20cc978b Merge branch 'wip/3v1n0/fd-query-path' into 'main'
glib-unix: Add API to lookup file path from FD

Closes #3806

See merge request GNOME/glib!4876
2025-10-22 12:44:34 +00:00
Abduqadir Abliz
cf4fdeb01c Uyghur language translation updated. 2025-10-22 13:36:22 +01:00
Michael Catanzaro
921d3ac2de Merge branch 'pgriffis/localhost-only-ipv6' into 'main'
gresolver: Fix loopback detection of IPv6 addresses

See merge request GNOME/glib!4877
2025-10-21 16:16:27 -05:00