Commit Graph

32354 Commits

Author SHA1 Message Date
Luca Bacci
663ee11fda Add OS profile app to executables
Fixes #3733
2025-11-20 11:00:59 +01:00
Luca Bacci
c836a71114 Add OS profile sources for Windows 2025-11-20 11:00:53 +01:00
Philip Withnall
298fa45f90 Merge branch 'glib/no-color-env' into 'main'
glog: guard NO_COLOR environment variable check with a GOnce for performance reasons

See merge request GNOME/glib!4904
2025-11-12 11:24:12 +00:00
Aaron Andersen
705de2e714 glog: guard NO_COLOR environment variable check with a GOnce for performance reasons 2025-11-11 20:31:50 -05:00
Philip Withnall
8ebc5b8502 Merge branch 'g_gnuc_flag_enum' into 'main'
Add G_GNUC_FLAG_ENUM

See merge request GNOME/glib!4900
2025-11-11 11:12:03 +00:00
Philip Withnall
91524a98c5 Merge branch 'getenv-invalid-names' into 'main'
genvironment: consider macOS behavior when testing g_getenv

See merge request GNOME/glib!4899
2025-11-09 18:22:32 +00:00
Philip Chimento
9e0736abc9 gregex: Ensure all bits are named in GRegexCompileFlags
This is to avoid the Wflag-enum warning that Clang emits when you have a
flags enum where a multi-bit value encompasses a bit that doesn't have a
corresponding single-bit value.

(I'm not sure why G_REGEX_NEWLINE_ANYCRLF isn't just 1 << 22...)
2025-11-07 22:44:35 -08:00
Philip Chimento
20fa7ec959 ghook: Ensure all bits are named in GHookFlagMask
This is to avoid the Wflag-enum warning that Clang emits when you have a
flags enum where a multi-bit value encompasses a bit that doesn't have a
corresponding single-bit value.
2025-11-07 22:44:35 -08:00
Philip Chimento
0a87b5bc1a all: Apply G_GNUC_FLAG_ENUM to all flags enums 2025-11-07 22:44:35 -08:00
Philip Chimento
1fbbf39334 mkenums: Handle G_GNUC_FLAG_ENUM annotation
It can appear either after 'enum' or after the closing brace. Also handle
__attribute__((flag_enum)) and, for C++ code, [[gnu::flag_enum]] and
[[clang::flag_enum]] and various other spellings of those. If it is
present, mark the enum as a flags enum, the same as if we detected left
shifts in the values.
2025-11-07 22:44:35 -08:00
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
André Barnabá Silva
6ea3ce88c3 tests: consider macOS behaviour in g_getenv tests
This change adds the macOS behaviour to assertions when testing g_getenv
with `=` in key names.

environment tests for Darwin were also re-enabled
2025-11-07 15:03:33 -03:00
Philip Withnall
c44555d2a4 Merge branch 'glib/no-color-env' into 'main'
glog: respect NO_COLOR environment variable

See merge request GNOME/glib!4898
2025-11-05 15:47:47 +00:00
Aaron Andersen
a53df3a4b8 glog: respect NO_COLOR environment variable
citing https://no-color.org/

> Command-line software which adds ANSI color to its output by default should check
> for a NO_COLOR environment variable that, when present and not an empty string
> (regardless of its value), prevents the addition of ANSI color.
2025-11-04 19:05:32 -05: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