Commit Graph

26191 Commits

Author SHA1 Message Date
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
Philip Withnall
d0eaccccad build: Mark the g-file-info test as succeeding
Previously it was marked as failing on macOS, but commit
ed3998b390 seems to have fixed that. yay!

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

Helps: #1392
2022-10-21 15:48:33 +01:00
Emmanuele Bassi
86430a27d2 Merge branch 'time' into 'main'
gio/tests/g-file-info: don't assume million-in-one events don't happen

See merge request GNOME/glib!2990
2022-10-20 15:11:56 +00:00
Philip Withnall
2365452d6e Merge branch 'allow-mixed-declarations' into 'main'
meson: Don't explicitly disable mixed declarations and statements

See merge request GNOME/glib!2951
2022-10-20 14:32:23 +00:00
Ross Burton
ed3998b390 gio/tests/g-file-info: don't assume million-in-one events don't happen
The access and creation time tests create a file, gets the time in
seconds, then gets the time in microseconds and assumes that the
difference between the two has to be above 0.

As rare as this may be, it can happen:

$ stat g-file-info-test-50A450 -c %y
2021-07-06 18:24:56.000000767 +0100

Change the test to simply assert that the difference not negative to
handle this case.

This is the same fix as 289f8b, but that was just modification time.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2022-10-20 14:41:56 +01:00
Philip Withnall
1db9066485 Merge branch 'fix-gstrerror-warning' into 'main'
gstrfuncs: Fix a compiler warning in g_strerror()

See merge request GNOME/glib!2956
2022-10-20 12:36:27 +00:00
Philip Withnall
4dcb7f1f9f Merge branch '2753-vasprintf-loop' into 'main'
gprintf: Avoid an infinite loop on ENOMEM in g_vasprintf()

Closes #2753

See merge request GNOME/glib!2944
2022-10-20 12:29:11 +00:00
Marco Trevisan
e49c4b1a9e Merge branch 'python-code-style-again' into 'main'
tests: Fix code style in Python files to satisfy black and flake8

See merge request GNOME/glib!2984
2022-10-20 11:59:53 +00:00
Michael Catanzaro
21a784920d Merge branch 'th/gspawn-no-safe-close' into 'main'
gspawn: avoid race due to retry with EINTR on close()

See merge request GNOME/glib!2947
2022-10-20 11:55:08 +00:00
Philip Withnall
e6fa40bf99 Merge branch 'wip/3v1n0/add-darwin-os' into 'main'
meson: Define G_OS_DARWIN when compiling under OSX or iOS

See merge request GNOME/glib!2981
2022-10-20 11:41:48 +00:00
Philip Withnall
5b01b47c34 Merge branch 'gicon-introspect-vfuncs' into 'main'
gicon: Add introspection for to_tokens / from_tokens vfunc's

See merge request GNOME/glib!2937
2022-10-20 11:39:04 +00:00
Thomas Haller
d6790aecca gspawn: use g_close()
g_close() now is async-signal-safe, as long as we don't request a GError
and pass a valid file descriptor.

Update "gspawn.c" to drop its safe_close() function and use
g_close() instead.
2022-10-20 08:16:52 +02:00
Thomas Haller
3ed7f4d1ed gstdio: make g_close() async-signal-safe under certain conditions
g_close() does something useful. It is not trivial to get EINTR handling of
close() right, in a portable manner. g_close() abstracts this.

We should allow glib users to use the function even in async-signal-safe
contexts, at least if the user heeds the caveat about GError and take care
not to fail assertions.
2022-10-20 08:16:38 +02:00
Marco Trevisan (Treviño)
476e33c3f3 gio, glib: Use G_OS_DARWIN for code that is for such environments
While we preserved the COCOA/CARBON cases when specific libraries are
needed.
2022-10-20 03:37:21 +02:00
Marco Trevisan (Treviño)
e85635daa0 meson: Define G_OS_DARWIN when compiling under OSX or iOS
It has enough differences to expose it as an unix-subtype.
2022-10-20 03:37:03 +02:00
Thomas Haller
6418db829b gspawn: avoid race due to retry with EINTR on close()
Retry on EINTR is wrong on many OS, including Linux. See the comment
in g_close() why that is.

As we cannot use g_close() after fork, we had safe_close(). This had the
wrong retry loop on EINTR. Drop that.

This was especially problematic since commit 6f46294227 ('gspawn: Don’t
use g_close() in async-signal-safe context'). Before, safe_close() was
only called after fork, where there is only one thread and there is no
concern about a race.

This patch only exists for easier backporting of the bugfix. The code
will be reworked further next.

Fixes: 6f46294227 ('gspawn: Don’t use g_close() in async-signal-safe context')
2022-10-19 20:54:18 +02:00
Philip Withnall
06029c5945 Merge branch 'remove-docs-artifacts' into 'main'
ci: Do not store docs artifacts

See merge request GNOME/glib!2985
2022-10-19 18:21:51 +00:00
Matthias Clasen
65536b079d gstrfuncs: Fix a compiler warning in g_strerror()
MSVC is complaining about this code. Let’s try
to help it see the light.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2800
2022-10-19 14:53:45 +01:00