Commit Graph

9228 Commits

Author SHA1 Message Date
Philip Withnall
bfdd7031e0 tests: Update Meson subcommand usage in static-link test
This just silences a few warnings from Meson about using deprecated
subcommands.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-11-25 15:25:38 +00:00
Philip Withnall
8f0c9b2fe1 tests: Fix static-link test when running installed
This effectively reverts commit 663ee11fda
for this `meson.build` file. This `meson.build` file isn’t actually
pulled into the main GLib (or GIO) build; it’s actually just installed
and then later called from a `meson` subprocess of `static-link.py`.

So it doesn’t have access to the `app_profile_dep` variable, which is
internal to GLib.

Fixes this CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/5834610

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-11-25 15:08:30 +00:00
Christian Hergert
f1a90a67c3 gio/gunixmounts: mark some file-system types as system
Since this list was originally created, more file system types have
become commonly used and would benefit from being marked as a system
file-system type.

This was found while tracking down some performance issues in
gnome-settings-daemon trash handling.
2025-11-21 12:32:07 -08:00
Michael Catanzaro
356f211a6c gdbusprivate: replace an else clause with a goto
This allows us to remove one level of nested indentation.
2025-11-20 15:06:12 -06:00
Michael Catanzaro
cd0c2e8de1 gdbusprivate: check length of path to GDBus binary
The code assumes that find_dbus_process_path() will return a wide
character string that is no longer than MAX_PATH. But this might not be
guaranteed to be true.

This was flagged in #YWH-PGM9867-119. The vulnerability hunter failed to
find any way to reach this code, so maybe it's not actually possible,
but we might as well check the size to be safe.
2025-11-20 15:06:12 -06:00
Philip Withnall
bb7cec29f7 Merge branch 'os-profile' into 'main'
Add app-profile static lib for Windows

Closes #3733

See merge request GNOME/glib!4788
2025-11-20 16:36:56 +00:00
Philip Withnall
a74ee4fb5c Merge branch 'wip/Jehan/gimp-issue-15239' into 'main'
Issue #3819: G_FILE_MONITOR_WATCH_HARD_LINK does not monitor files on Windows.

Closes #3819

See merge request GNOME/glib!4901
2025-11-20 15:46:25 +00:00
Philip Withnall
8c2ce2bb7a Merge branch 'macos-testfilemonitor-fix' into 'main'
testfilemonitor: treat `CHANGES_DONE_HINT` as optional when events don’t match

Closes #1181

See merge request GNOME/glib!4905
2025-11-20 13:25:47 +00:00
Luca Bacci
ef0edb01ad Use template library RC file 2025-11-20 11:00:59 +01:00
Luca Bacci
663ee11fda Add OS profile app to executables
Fixes #3733
2025-11-20 11:00:59 +01:00
g.willems
373fd1079a glocalfile: Fix trash user cancellation not reported
`SHFileOperationW()` may not always return success in case of
user-aborted operation, `ERROR_CANCELLED` was also observed
when cancelling a move-to-recycle-bin confirmation dialog.

Ensure `G_IO_ERROR_CANCELLED` is properly reported to the application,
instead of the generic `G_IO_ERROR_FAILED`.
2025-11-18 21:08:40 +01:00
Philip Withnall
5f256ba23f Merge branch 'faccessat_errno' into 'main'
glocalfile: Complain if `faccessat` sets an unusual error and use AT_FDCWD

See merge request GNOME/glib!4908
2025-11-17 12:58:21 +00:00
Colin Kinloch
32f246561e glocalfile: Pass AT_FDCWD to faccessat
`filename` should always be absolute when it's passed to `faccessat` so
this shouldn't change the behavior.

Apparently NetBSD checks the value of `dirfd` even when `pathname` is
absolute which results in an error:
https://gitlab.gnome.org/GNOME/glib/-/issues/3495#note_2605408
2025-11-16 17:01:51 +00:00
Colin Kinloch
8f8e3a43d7 glocalfile: Complain if faccessat sets an unusual error
Many libc implementations seem to be incompatible with this
optimisation.

Printing an error when the error is either `EINVAL` or `EBADF` should
make it easier to identify any more problematic platforms.
2025-11-16 17:01:48 +00:00
Ville Skyttä
b61bdee3bd completion: fix error on nounset mode unknown completions
With the shell in "nounset" mode (`set -u`), an error was output for
unknown completions, for example `gsettings set non existent <TAB>`.
2025-11-16 17:07:32 +02:00
André Barnabá Silva
1051394c36 testfilemonitor: treat CHANGES_DONE_HINT as optional when events don’t
match

This expands on the previous fixes to the kqueue backend testing, to
always treat `CHANGES_DONE_HINT` as optional when there is a mismatch
checking the expected events.

Also re-enable the tests for macOS.

Helps: #1392
2025-11-12 04:46:02 -03:00
Philip Chimento
0a87b5bc1a all: Apply G_GNUC_FLAG_ENUM to all flags enums 2025-11-07 22:44:35 -08:00
Jehan
a76a1bba53 Issue #3819: G_FILE_MONITOR_WATCH_HARD_LINK does not monitor files on Windows.
Current code was clearly considering the case of having only a filename
as a directory monitoring, instead of a hard-link monitoring. As I
assume that hard links don't exist on Windows, this case should simply
revert back to the basic file monitoring code path.
2025-11-07 12:09:43 +01: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
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
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
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
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
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
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
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
Patrick Griffis
549ed21ea1 gresolver: Fix loopback detection of IPv6 addresses
Previously the len passed to g_socket_address_new_from_native() was only
for IPv4 addresses and the constructor would fail.

This was reported and discussed here:
fe0139ee98 (note_2581394)
2025-10-21 15:43:21 -05:00
Marco Trevisan (Treviño)
dda9b9cc79 gio/tests/fake-document-portal: Use g_unix_fd_query_path()
Fixes: bc35a149
Closes: #3806
2025-10-21 19:17:46 +02:00
Marco Trevisan (Treviño)
10e9072634 gio/fake-desktop-portal: Use g_unix_fd_query_path 2025-10-21 19:17:46 +02:00
André Barnabá Silva
9222f71753 glocalfileinfo: implement _g_stat_{a,c,m}_nsec for macOS
add implementations for these functions using st_{a,c,m}timespec when
__APPLE__ is defined. Also re-enable the g-file-info test for darwin.

Fixes #3070, #2608
2025-10-20 23:37:42 -03:00
Sebastian Dröge
bdd51aa8ca Mark return value of g_dbus_interface_get_info() as nullable
`GDBusProxy` implements this interface but allows construction with a
`NULL` interface info and also marks its getter/setter for the interface
info accordingly.

Callers of `g_dbus_interface_get_info()` need to assume that it can
return `NULL` unless they constructed the `GDBusInterface` in a way that
guarantees that the interface info is available.
2025-10-20 20:47:38 +00:00
Philip Withnall
bbc508b78f gnetworkmonitorbase: Add missing notify::connectivity signal
The connectivity is directly derived from the `is_available` variable,
so if that changes, we need to notify of a change in `connectivity` too.

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

Fixes: #3803
2025-10-20 16:15:45 +01:00
Luca Bacci
5a3231dbda GIO/Win32: Remove custom definitions of system interfaces 2025-10-17 10:46:01 +02:00
Marco Trevisan
618d45cc83 Merge branch 'snap-document-portal-launch' into 'main'
GDesktopAppInfo: Use document portal to open all the URIs for snaps

See merge request GNOME/glib!4822
2025-10-17 04:00:20 +02:00
Marco Trevisan (Treviño)
bc35a1496d gio/gdesktopappinfo: Also use document portal for desktop file snaps
When a snap is launched from its non-dbus-activable desktop file we may
still need to use the portal to pass the URIs to the program, so that it
can access to them even if confined.

In fact most snaps are not dbus-activable, but they rely on the classic
desktop file activation.
2025-10-17 03:48:55 +02:00
Marco Trevisan
bd4b57e811 Merge branch 'scan-build-fixes' into 'main'
Fix various scan-build errors

See merge request GNOME/glib!4866
2025-10-17 03:47:16 +02:00
Philip Withnall
d904f77770 gunixmounts: Silence a scan-build false positive about a file handle leak
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-17 00:27:02 +01:00
Marco Trevisan (Treviño)
29fdcec8f3 gio/tests/desktop-app-info: Check child exit status
We need to ensure that the child we launch is not failing otherwise it
won't be possible to catch any assertion failure that it may happen
2025-10-17 01:07:33 +02:00
Philip Withnall
3e1176e4b8 Merge branch 'socket-control-docs' into 'main'
gsocketcontrolmessage: Fix a minor typo in a doc comment

See merge request GNOME/glib!4858
2025-10-16 21:10:46 +00:00
Philip Withnall
0ab1866145 Merge branch '3798-appinfo-portal-crash' into 'main'
gopenuriportal: Fix a crash when the file can’t be opened

Closes #3798

See merge request GNOME/glib!4859
2025-10-16 21:04:12 +00:00
Marco Trevisan (Treviño)
23c2483703 gio/gdesktopappinfo: Use document portal to open URIs for dbus-started snaps
Snap applications like flatpak apps may need to use the portals to open
files, so use the same logic that we have for flatpaks but using the
snap ID that matches portal expectations
2025-10-16 22:12:00 +02:00
Philip Withnall
21179497cf Merge branch 'zero-terminated-annotations' into 'main'
gio: add some nullable / zero-terminated annotations

See merge request GNOME/glib!4789
2025-10-16 20:10:49 +00:00