Commit Graph

26158 Commits

Author SHA1 Message Date
Simon McVittie
fe7eb71c43 docs: Soft-deprecate G_VA_COPY in favour of va_copy
We now require C99, which guarantees that va_copy is available.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Marco Trevisan
b9e68b0bd4 Merge branch 'support-xdg-terminal-exec' into 'main'
Add support for xdg-terminal-exec for handling desktop applications using 'Terminal=true'

See merge request GNOME/glib!2839
2022-10-26 17:03:12 +00:00
Marco Trevisan
0d425bc276 Merge branch 'fix-install-tag-check' into 'main'
ci: Fix check for missing install tag

See merge request GNOME/glib!3019
2022-10-26 16:51:17 +00:00
Max Gautier
dd9bc7cf59 gio: test xdg-terminal-exec usage 2022-10-26 18:41:26 +02:00
Max Gautier
22e1b9bcc0 gio: add xdg-terminal-exec as a known terminal
Allow users to select their terminal of choice by using the
xdg-terminal-exec wrapper.

It is a temporary temporary solution while waiting for the
xdg-default-apps specification
(https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/54), in
accordance with this comment:
https://gitlab.gnome.org/GNOME/glib/-/issues/338#note_1076172
2022-10-26 18:41:26 +02:00
Max Gautier
b64347d279 gio: add support for terminal with no option
Introduce support for terminals executing commands without an option,
i.e., the command is passed directly as argument to the terminal emulator.
This is needed for xdg-terminal-exec.
2022-10-26 18:41:26 +02:00
Max Gautier
eb2d1d8fc8 gio: Refactor the known terminals search
Get rid of multiple conditionals branch by using a loop and storing the
options needed by particular terminal emulators directly in an array.
Remove intermediate variable term_argv as we don't need it.

Advantages:
- simpler logic, less branching
- the terminal emulator list is more readable, by virtue of being
  condensed in one array. Launch options to execute a terminal program
  are also more explicitly specified
- the logic become independent from the order
- one less allocation
2022-10-26 18:15:26 +02:00
Xavier Claessens
a4eb39dde8 ci: Fix failing tests not failing CI job 2022-10-26 11:55:56 -04:00
Xavier Claessens
9ba01dc7fc ci: Fix check for missing install tag
Better check the installation plan json file instead of parsing logs.
2022-10-26 11:55:56 -04:00
Xavier Claessens
b8a0ffa1b9 meson: Add missing install tags 2022-10-26 11:55:56 -04:00
Marco Trevisan
1590e7636c Merge branch 'ebassi/version-header-install' into 'main'
Install gversionmacros.h in the right place

See merge request GNOME/glib!3018
2022-10-26 15:04:01 +00:00
Emmanuele Bassi
0ea1d3fecc Install gversionmacros.h in the right place
The gversionmacros.h header is referenced from glib/, so it needs to go
into glib's include directory, not in the top-level alongside glib.h,
glib-object.h, gmodule.h, and glib-unix.h.
2022-10-26 15:05:36 +01:00
Philip Withnall
e11bf10eac Merge branch 'RTLD_DEFAULT' into 'main'
Handle plugable g_modules through RTLD_DEFAULT for NetBSD

Closes #19

See merge request GNOME/glib!3014
2022-10-26 09:47:51 +00:00
Philip Withnall
010d831e0e Merge branch 'fix-desktop-app-info-leak' into 'main'
gio/gdesktopappinfo: Free the wrapped argv array on launch failure

See merge request GNOME/glib!3008
2022-10-26 09:28:08 +00:00
Philip Withnall
ed05da29f7 Merge branch 'cesun/fix-add-instance-private-typo' into 'main'
Fix function name typo in comment of gtype.c

Closes #2791

See merge request GNOME/glib!3016
2022-10-26 08:32:40 +00:00
sunce
ea1b2cba0c Fix function name typo in comment of gtype.c
The function adjusting private struct size to private struct offset
should be `g_type_class_adjust_private_offset`, instead of the
previously misspelled `g_type_class_add_instance_private` in comment.

Fixes #2791
2022-10-26 10:17:39 +08:00
Philip Withnall
e562c3b8a3 Merge branch 'wip/3v1n0/clang-warning-fixes' into 'main'
tests: Fix few new clang warnings

See merge request GNOME/glib!3013
2022-10-25 16:04:10 +00:00
Emmanuel Fleury
81e4498565 Handle plugable g_modules through RTLD_DEFAULT for NetBSD
fix issue #19
2022-10-25 17:31:25 +02:00
Marco Trevisan (Treviño)
dafd6602dc gio/gdesktopappinfo: Free the wrapped argv array on launch failure
We create an array that we never free, ensure this is the case.
The previous commit gives CI a chance to check this with valgrind job.

Found as part of another review:
 - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839#note_1524922
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
37e61d66c3 gio/tests/desktop-app-info: Add test to check failure on launch as manager
Trying to use invalid Fd's numbers so that this would fail early.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
6bbc72d2c4 gio/tests/desktop-app-info: Add a TestLaunchContext to improve SN testing
Add a custom launch context implementation so that we can test the
startup notification code better.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
ec67c7dbf2 desktop-app-info: Run test without display, they work with no issue 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
d4a31897ab tests/desktop-app-info: Check if launched signal is emitted 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
a156998bee gvariant: Add missing explicit g_variant_dict_lookup tests 2022-10-25 14:31:02 +02:00
Philip Withnall
60ceaa77be Merge branch 'timezone-relative-link-target' into 'main'
gtimezone: Fix symlink checks on relative link targets

See merge request GNOME/glib!3009
2022-10-25 12:21:40 +00:00
Fabio Tomat
f25d7d9060 Update Friulian translation
(cherry picked from commit 142f1712d2)
2022-10-25 11:43:14 +00:00
Marco Trevisan
a3488a38e7 Merge branch 'wip/add-built-headers-deps-v2' into 'main'
meson: Cleanup and fix include files paths, using base path without repetitions

See merge request GNOME/glib!3011
2022-10-25 09:14:15 +00:00
Simon McVittie
7b05defa0e Merge branch 'wip/smcv/pointers-can-be-large' into 'main'
docs: Stop claiming that gsize is wide enough to hold a pointer

See merge request GNOME/glib!3000
2022-10-24 20:29:07 +00:00
Philip Withnall
e33f23a6b5 Merge branch 'wip/smcv/64-bit-hash' into 'main'
ghash: Correctly retrieve low 32 bits of 64-bit values

Closes #2787

See merge request GNOME/glib!2994
2022-10-24 20:22:15 +00:00
Philip Withnall
7b09713963 Merge branch 'floating-variants-grr' into 'main'
Always ref-sink variants in g_object_set

Closes #2774

See merge request GNOME/glib!2934
2022-10-24 20:21:53 +00:00
Philip Withnall
521d481d64 Merge branch 'wip/smcv/standard-offsetof' into 'main'
docs: Soft-deprecate G_STRUCT_OFFSET in favour of offsetof

See merge request GNOME/glib!3002
2022-10-24 20:09:54 +00:00
Marco Trevisan (Treviño)
0de22a8864 tests/strfuncs: Do not compare string literal with pointers
Otherwise clang would complain:

  ../glib/tests/strfuncs.c:2603:32: warning: result of comparison
    against a string literal is unspecified (use an explicit string
    comparison function instead) [-Wstring-compare]
    g_assert_true ((gpointer)str != (gpointer)"");
                                 ^  ~~~~~~~~~~~~
  ../glib/gtestutils.h:187:59: note: expanded from macro 'g_assert_true'
                                               if G_LIKELY (expr) ; else \
                                                            ^~~~
  ../glib/gmacros.h:1186:59: note: expanded from macro 'G_LIKELY'
  #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
                                                            ^~~~
  ../glib/gmacros.h:1180:8: note: expanded from macro '_G_BOOLEAN_EXPR'
     if (expr)
2022-10-24 21:34:35 +02:00
Marco Trevisan (Treviño)
8341a1cf06 tests/sequence: Ensure iterator is set and actually checked
Clang was complaining:

  ../glib/tests/sequence.c:125:7: warning: variable 'i' set but not used
    int i;
        ^
  1 warning generated.
2022-10-24 21:33:18 +02:00
Marco Trevisan (Treviño)
836fd0563d meson: Remove unneeded install_tag's on headers
Meson is able to handle this automatically when we're installing in the
include-dir prefix.
2022-10-24 21:09:49 +02:00
Marco Trevisan (Treviño)
6dd222e753 meson: Cleanup include-dir paths, use base path without repetitions
Avoid setting the subdir all the times, just use the global definition
plus the specific module subdir
2022-10-24 21:09:09 +02:00
Xavier Claessens
8fe2e4d364 Merge branch 'wip/add-built-headers-deps' into 'main'
glib, gmodule, gobject: Add generated headers to the lib dependency

See merge request GNOME/glib!2991
2022-10-24 13:51:30 +00:00
Philip Withnall
5553a44b1b gfileutils: Mention possibility of relative paths in g_file_read_link()
It’s entirely possible that `g_file_read_link()` will return a relative
path. Mention that in the documentation, and include a short example of
how to make the path absolute for further computation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 12:38:15 +01:00
Philip Withnall
f8c80391ae gtimezone: Fix symlink checks on relative link targets
The changes in 6265b2e6f7 to reject weird
`/etc/localtime` configurations where `/etc/localtime` links to another
symlink did not consider the case where the target of `/etc/localtime`
is a *relative* path. They only considered the case where the target is
absolute.

Relative paths are permissible in all symlinks. On my Fedora 36 system,
`/etc/localtime`’s target is `../usr/share/zoneinfo/Europe/London`.

Fix the check for toolbx by resolving relative paths before calling
`g_lstat()` on them.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 12:35:29 +01:00
Simon McVittie
64945e6386 docs: Stop claiming that gsize is wide enough to hold a pointer
Standard C specifically does not guarantee this, and it's untrue on
CHERI architectures (which have 128-bit pointers into a 64-bit
address space, with the remaining bits used for a capability-like
mechanism).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 11:11:18 +01:00
Matthias Clasen
e79af74d1b gobject: Always ref-sink variants in g_object_set
When collecting varargs, ignore the NOCOPY_CONTENTS
flag for variants. That is what our docs advice for
refcounted types, and it fixes a regression that
was inadvertendly introduced when we stopped doing
some extra GValue copies.

Includes a test case by Philip Withnall.

Fixes: #2774
2022-10-24 10:47:35 +01:00
Simon McVittie
de7abf54c7 ghash: Correctly retrieve low 32 bits of 64-bit values
Dereferencing a pointer to a 64-bit object as though it was a 32-bit
object is the same as taking the least significant 32 bits on a
little-endian machine, but on a big-endian machine it is the same as
taking the *most* significant 32 bits, which would result in these hash
functions always hashing to zero. The /hash/int64/collisions and
/hash/double/collisions test-cases in glib/tests/hash.c detect this
and fail.

Instead, fetch the whole 64-bit quantity and do the bit-manipulation
to xor the more significant half with the less significant half in an
architecture-neutral way.

Fixes: dd1f4f70 "Optimize g_double_hash implementation"
Fixes: c1af4b2b "Optional optimization for `g_int64_hash`"
Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2787
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 10:46:57 +01:00
Simon McVittie
8e752b2733 docs: Soft-deprecate G_STRUCT_OFFSET in favour of offsetof
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 10:43:43 +01:00
Marco Trevisan (Treviño)
681bb3cb21 gnulib: Add glib built headers to the gnulib_lib required sources
g-gnulib.h includes glib.h that requires some headers to be generated,
so ensure that this is always the case.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2349167
2022-10-23 18:04:56 +02:00
Marco Trevisan (Treviño)
f67743e9a2 glib: Also include glibconfig.h in the libglib dependencies and sources
It must be there to build, or we'd fail:

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346909
2022-10-23 18:04:56 +02:00
Marco Trevisan (Treviño)
341895a19e glib, gmodule, gobject: Add generated headers to the lib dependency
This requires changing them from being generated sources at compile time
to custom targets, but it also ensures that they are actually there when
needed, in fact currently we may instead try to compile files that requires
them without having been generated yet.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346914 (glib)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2344802 (gmodule)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2345205 (gobject)
2022-10-23 18:04:56 +02:00
Marco Trevisan (Treviño)
7e5c5932fc meson: cleanup libglib dependencies
Move it multi-line to keep it more readable
2022-10-23 18:04:55 +02:00
Simon McVittie
662661a8d0 Merge branch 'wip/pwithnall/macos-file-info-test-fixed' into 'main'
build: Mark the g-file-info test as succeeding

See merge request GNOME/glib!3004
2022-10-21 18:56:12 +00:00
Marco Trevisan
d83c87c1f6 Merge branch 'gdbus-server-no-abstract-tmpdir' into 'main'
Fix sandbox escape in GDBusServer

See merge request GNOME/glib!3005
2022-10-21 16:09:12 +00:00
msizanoen1
9151fe94cb gio: remove pointless use of g_unix_socket_address_abstract_names_supported with unix:tmpdir=
There's no point in checking for
g_unix_socket_address_abstract_names_supported now that unix:tmpdir=
always use non-abstract sockets.
2022-10-21 22:09:06 +07:00
msizanoen1
c0a1a3b384 gio/gdbusserver: use non-abstract socket for unix:tmpdir=
This implements https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/350
for GDBus's server implementation.

Abstract sockets belong to the network namespace instead of the mount
namespace. As a result, mount namespace-based sandboxes (e.g. Flatpak)
cannot restrict access to abstract sockets (and therefore GDBus's
unix:tmpdir= server addresses), at least for applications with network
access permission, which may result in sandbox escapes unless the
application running the GDBus server explicitly check that the connecting
process is not in a sandbox. As of the time of writing, no known
applications using GDBusServer does this.

Fix this by always using non-abstract sockets for unix:tmpdir=, which is
allowed by the DBus specification.
2022-10-21 22:08:11 +07:00