summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 2.75.12.75.1Philip Withnall2022-12-211-3/+157
| | | | Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* Merge branch '2840-2841-variant-more-fixes' into 'main'Philip Withnall2022-12-213-5/+74
|\ | | | | | | | | | | | | gvariant: Check offset table doesn’t fall outside variant bounds and speed up text parsing Closes #2840 and #2841 See merge request GNOME/glib!3163
| * gvariant: Propagate trust when getting a child of a serialised variantPhilip Withnall2022-12-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a variant is trusted, that means all its children are trusted, so ensure that their checked offsets are set as such. This allows a lot of the offset table checks to be avoided when getting children from trusted serialised tuples, which speeds things up. No unit test is included because this is just a performance fix. If there are other slownesses, or regressions, in serialised `GVariant` performance, the fuzzing setup will catch them like it did this one. This change does reduce the time to run the oss-fuzz reproducer from 80s to about 0.7s on my machine. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2841 oss-fuzz#54314
| * gvariant: Check offset table doesn’t fall outside variant boundsPhilip Withnall2022-12-212-3/+72
|/ | | | | | | | | | | | | | | | | When dereferencing the first entry in the offset table for a tuple, check that it doesn’t fall outside the bounds of the variant first. This prevents an out-of-bounds read from some non-normal tuples. This bug was introduced in commit 73d0aa81c2575a5c9ae77d. Includes a unit test, although the test will likely only catch the original bug if run with asan enabled. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2840 oss-fuzz#54302
* Merge branch 'ptr-array-new-take' into 'main'Philip Withnall2022-12-214-2/+1211
|\ | | | | | | | | garray: Add more G(Ptr)Array constructors to take or copy C arrays See merge request GNOME/glib!3128
| * garray: Fix a doc typo in g_ptr_array_sort()Marco Trevisan (Treviño)2022-12-211-1/+1
| |
| * garray: Add g_array_new_take() and g_array_new_take_zero_terminated()Marco Trevisan (Treviño)2022-12-214-0/+319
| | | | | | | | | | Make it easy to handle C arrays using GArray API stealing data from other sources.
| * garray: Just use one bit to hold the null teminated stateMarco Trevisan (Treviño)2022-12-191-1/+1
| | | | | | | | | | This is probably ignored for saving space because of padding optimizations, but since we want this value to be either 0 or 1, this enforces this too.
| * garray: Add g_ptr_array_new_from_null_terminated_array()Marco Trevisan (Treviño)2022-12-194-14/+272
| | | | | | | | | | | | It allows to create a GPtrArray from a null-terminated C array computing its size and in case performing copies of the its values using the provided GCopyFunc.
| * garray: Add g_ptr_array_new_from_array() to copy a C arrayMarco Trevisan (Treviño)2022-12-194-1/+214
| | | | | | | | | | It makes it easier (and more optimized) to create a GPtrArray from a C-style array of pointers, in case using a GCopyFunc to duplicate the elements.
| * garray: Add g_ptr_array_new_take_null_terminated()Marco Trevisan (Treviño)2022-12-194-0/+222
| | | | | | | | | | Similar to g_ptr_array_new_take() but it also computes the length of a zero-terminated array.
| * garray: Add g_ptr_array_new_take() to take a C array without copiesMarco Trevisan (Treviño)2022-12-194-0/+197
| | | | | | | | | | | | | | | | | | GPtrArray is a nice interface to handle pointer arrays, however if a classic array needs to be converted into a GPtrArray is currently needed to manually go through all its elements and do new allocations that could be avoided. So add g_ptr_array_new_take() which steals the data from an array of pointers and allows to manage it using the GPtrArray API.
* | Merge branch 'disable-assert-warning-fix' into 'main'Emmanuele Bassi2022-12-211-0/+4
|\ \ | | | | | | | | | | | | gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERT See merge request GNOME/glib!3159
| * | gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERTPhilip Withnall2022-12-211-0/+4
| | | | | | | | | | | | | | | | | | Spotted in https://gitlab.gnome.org/GNOME/glib/-/jobs/2461358 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* | | Merge branch '2852-musl-siginfo-t' into 'main'Emmanuele Bassi2022-12-211-8/+10
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | gmain: Define fallback values for siginfo_t constants for musl Closes #2852 See merge request GNOME/glib!3158
| * | | gmain: Define fallback values for siginfo_t constants for muslPhilip Withnall2022-12-211-8/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | musl doesn’t define them itself, presumably because they’re not defined in POSIX. glibc does define them. Thankfully, the values used in glibc match the values used internally in other musl macros. Define the values as a fallback. As a result of this, we can get rid of the `g_assert_if_reached()` checks in `siginfo_t_to_wait_status()`. This should fix catching signals from a subprocess when built against musl. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2852
* | | Merge branch 'gobject-value-set-cleanups' into 'main'Philip Withnall2022-12-212-22/+15
|\ \ \ | |/ / |/| | | | | | | | gobject: Some GValue setting code cleanups See merge request GNOME/glib!3156
| * | gobject: Use some new cleaner code to set object GValuesMarco Trevisan (Treviño)2022-12-201-21/+10
| | | | | | | | | | | | | | | Use some newer APIs to make the code nicer cleaner and clearer in terms of memory ownership.
| * | gobject: Avoid the ref/unref dance if assigning the same to a valueMarco Trevisan (Treviño)2022-12-202-1/+5
| | | | | | | | | | | | | | | g_value_set_object could lead to perform unneeded ref/unref operations in case we were trying to set again an object to a GValue
* | | Merge branch 'search-app-prefix-strstr' into 'main'Philip Withnall2022-12-212-33/+88
|\ \ \ | | | | | | | | | | | | | | | | gdesktopappinfo: Group search results by both categories and match types See merge request GNOME/glib!3107
| * | | tests: Update search tests for desktop-icon-infoAlynx Zhou2022-12-201-8/+10
| | | | | | | | | | | | | | | | | | | | Because we now put substring match in the next group of prefix match, the test cases should also be updated.
| * | | gdesktopappinfo: Group search results by both categories and match typesAlynx Zhou2022-12-201-25/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Substring matches can have too much unwanted results, while prefix matches is more accurate but cannot handle some special cases, this commit combines them by adding a match_type member, then sort and group result with both categories and match types. For the same category, prefix matched results will be put in the first group and substring matched results will be put in the second group.
* | | | Merge branch '2753-vasprintf-loop' into 'main'Philip Withnall2022-12-213-0/+208
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | glib/tests: Add test to check that we abort on low-memory See merge request GNOME/glib!2992
| * | | | glib/tests: Add test to check that we abort on low-memoryMarco Trevisan (Treviño)2022-12-203-0/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case we're out of memory we should abort after having printed an error message, this is similar to crashing but not exactly the same, so ensure we exit for SIGABRT and not because of a SIGSEV. We use a test wrapper to ensure that both the exit code and the stderr match what we expected.
* | | | | Merge branch 'mcatanzaro/gthread-posix-errno' into 'main'Michael Catanzaro2022-12-201-0/+1
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | | | | | | gthread-posix: need to #include <errno.h> See merge request GNOME/glib!3157
| * | | | gthread-posix: need to #include <errno.h>Michael Catanzaro2022-12-201-0/+1
|/ / / / | | | | | | | | | | | | | | | | a79c6af23eff5ee978db62e048828c9a992a1261 uses errno without the required header.
* | | | Merge branch 'wip/pwithnall/freebsd-again' into 'main'Marco Trevisan2022-12-201-4/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Revert "ci: Temporarily only run the FreeBSD 13 CI on a schedule" See merge request GNOME/glib!3151
| * | | | Revert "ci: Temporarily only run the FreeBSD 13 CI on a schedule"Philip Withnall2022-12-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4f5bd5439e67e6e638cda22ae372a621a01057c7. The FreeBSD CI runner is back! See https://gitlab.gnome.org/Infrastructure/GitLab/-/issues/594#note_1620930
* | | | | Merge branch 'tests-isolated-tmpdir' into 'main'Marco Trevisan2022-12-197-6/+166
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | gtestutils: Use $G_TEST_TMPDIR as temporary directory when defined See merge request GNOME/glib!2886
| * | | | | gtestutils: Use $G_TEST_TMPDIR as temporary directory when definedMarco Trevisan (Treviño)2022-12-194-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During tests in which we are isolating directories, we may still create temporary files in the global temporary directory without cleaning them because the value returned by g_get_tmp_dir() is cached when we isolate the tests directory to the global TMPDIR. To ensure that we're always isolating the temporary directories, let's unset the cached temporary directory once we've defined $G_TEST_TMPDIR so that the returned value of g_get_tmpdir() can be recomputed using the test isolated temporary directory.
| * | | | | gutils: Add a private API to unset the cached temporary directoryMarco Trevisan (Treviño)2022-12-153-6/+46
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may need to avoid using a cached temp directory for testing purposes, so let's provide an internal API to perform such task. This implies removing GOnce and going with mutex-based version, but that's still using atomic logic in most unix implementations anyways.
* | | | | Merge branch 'ebassi/garray-revert' into 'main'Marco Trevisan2022-12-193-83/+8
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | Revert "garray: Add support adding literal values" Closes #2846 See merge request GNOME/glib!3154
| * | | | Revert "garray: Add support adding literal values"Emmanuele Bassi2022-12-193-83/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverts the following commits: - ab621e15b52a57c8d95b3f4d93493c82f0f3216e. - 85d9fb8e6c482d7b6d59efbf98040ad58d3f5008. Too many build breaking regressions. Fixes: #2846
* | | | Merge branch 'wip/pwithnall/debugging-macos-ci' into 'main'Emmanuele Bassi2022-12-191-6/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | tests: Fix stall/deadlock in slice-concurrent on macOS CI See merge request GNOME/glib!3152
| * | | | tests: Use a thread-local GRand in each slice-concurrent test threadPhilip Withnall2022-12-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents stalls/deadlocks/timeouts on macOS. I don’t know why, as I don’t have access to a macOS machine to test — this MR was put together via testing on CI. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
| * | | | tests: Fix operator precedence in slice-concurrentPhilip Withnall2022-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This regressed in commit 9f558a2c5017860c92d69396d36dc7a6b6a4e2af. Not sure if it makes a functional difference to the test, though. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* | | | | Merge branch 'futex64' into 'main'Philip Withnall2022-12-194-57/+138
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | glib/gthread-posix: Conditionally use `futex` and/or `futex_time64` syscalls... See merge request GNOME/glib!3120
| * | | | | glib/gthread-posix: Conditionally use `futex` and/or `futex_time64` syscalls ↵Sebastian Dröge2022-12-134-56/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as necessary and use the correct `struct timespec` definition On some systems only `futex_time64` exists (e.g. riscv32) while on others only `futex` exists (old Linux, 64 bit platforms), so it is necessary to check for both and try calling both at runtime. Additionally use the correct `struct timespec` definition. There is not necessarily any relation between the libc's definition and the kernel's. Specifically, the libc headers might use 64-bit `time_t` while the kernel headers use 32-bit `__kernel_old_time_t` on certain systems. To get around this problem we a) check if `futex_time64` is available, which only exists on 32-bit platforms and always uses 64-bit `time_t`. b) otherwise (or if that returns `ENOSYS`), we call the normal `futex` syscall with the `struct timespec` used by the kernel, which uses `__kernel_long_t` for both its fields. We use that instead of `__kernel_old_time_t` because it is equivalent and available in the kernel headers for a longer time.
| * | | | | glib/gthread-posix: Use `cc.compiles()` instead of `cc.links()` for checking ↵Sebastian Dröge2022-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for `__NR_futex` `cc.compiles()` is minimally faster. We only want to check here whether `__NR_futex` is defined and don't want to check anything at link-time.
* | | | | | Merge branch 'close-range-freebsd' into 'main'Philip Withnall2022-12-191-12/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | gspawn.c: prefer close_range() on FreeBSD if available See merge request GNOME/glib!3144
| * | | | | | gspawn.c: prefer close_range() on FreeBSD if availableAlexander Richardson2022-12-191-12/+12
| | |/ / / / | |/| | | |
* | | | | | Merge branch 'activation-token' into 'main'Philip Withnall2022-12-194-11/+39
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gdesktopappinfo: Set XDG_ACTIVATION_TOKEN/activation-token startup ID key Closes #2709 See merge request GNOME/glib!3090
| * | | | | gdesktopappinfo: Set XDG_ACTIVATION_TOKEN/activation-token startup ID keyIlya Fedin2022-12-194-11/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See: * https://gitlab.freedesktop.org/xdg/xdg-specs/-/blob/master/desktop-entry/desktop-entry-spec.xml#L1061-1068 * https://wayland.app/protocols/xdg-activation-v1 * https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst Fixes: #2709
* | | | | | Merge branch 'th/gtype-cast-align-warning' into 'main'Philip Withnall2022-12-193-4/+27
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | gtype: avoid "-Wcast-align" warning with optimized G_TYPE_CHECK_INSTANCE_CAST() See merge request GNOME/glib!3139
| * | | | | | meson: Add test to check for strict cast alignments if supportedMarco Trevisan (Treviño)2022-12-161-1/+7
| | | | | | |
| * | | | | | gtype: avoid "-Wcast-align" warning with optimized G_TYPE_CHECK_INSTANCE_CAST()Thomas Haller2022-12-162-3/+20
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can get a "-Wcast-align", if the target type that we cast to ("ct") has a larger alignment than GTypeInstance. That can happen on i686 architecture, if the GObject type has larger alignment than the parent struct (or GObject). Since on i686, embeding a "long long" or a "long double" in a struct still does not increase the alignment beyond 4 bytes, this usually only happens when using the __attribute__() to increase the alignment (or to have a field that has the alignment increased). It can happen on x86_64 when having a "long double" field. The compiler warning is hard to avoid but not very useful, because it purely operates on the pointer types at compile time. G_TYPE_CHECK_INSTANCE_CAST() instead asserts (in non-optimized mode) that the pointer really points to the expected GTypeInstance (and if that's the case, then the alignment should be suitable already). This is like in commit ed553e8e309d ('gtype: Eliminate -Wcast-align warnings with G_TYPE_CHECK_INSTANCE_CAST'). But also fix the optimized code path. With the unpatched G_TYPE_CHECK_INSTANCE_CAST() macro, the unit test would now show the problem (with gcc-9.3.1-2.fc30.i686 or gcc-12.2.1-4.fc37.x86_64): $ export G_DISABLE_CAST_CHECKS=1 $ export CFLAGS='-Wcast-align=strict' $ meson build $ ninja -C build ... In file included from ../gobject/gobject.h:26, from ../gobject/gbinding.h:31, from ../glib/glib-object.h:24, from ../gobject/tests/objects-refcount1.c:2: ../gobject/tests/objects-refcount1.c: In function ‘my_test_dispose’: ../gobject/gtype.h:2523:42: warning: cast increases required alignment of target type [-Wcast-align] 2523 | # define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) | ^ ../gobject/gtype.h:517:66: note: in expansion of macro ‘_G_TYPE_CIC’ 517 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) | ^~~~~~~~~~~ ../gobject/tests/objects-refcount1.c:9:37: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’ 9 | #define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../gobject/tests/objects-refcount1.c:96:10: note: in expansion of macro ‘MY_TEST’ 96 | test = MY_TEST (object); | ^~~~~~~
* | | | | | Merge branch 'ghash-unsigned-nnodes' into 'main'Philip Withnall2022-12-191-7/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ghash: Use unsigned types for number of nodes and occupied ones See merge request GNOME/glib!3148
| * | | | | | ghash: Use unsigned types for number of nodes and occupied onesMarco Trevisan (Treviño)2022-12-161-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has always been considered an unsigned value, and we also returned it straight as int in g_hash_table_size(), but it was actually used as an int. So use the same type of g_hash_table_size(). Not using more standard unsigned not to risk that it may different from the guint typedef.
* | | | | | | Merge branch 'wroy-main-patch-88172' into 'main'Philip Withnall2022-12-171-1/+1
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix g_array_append_val compilation on Windows Closes #2845 See merge request GNOME/glib!3150
| * | | | | | Fix g_array_append_val compilation on WindowsWilliam Roy2022-12-171-1/+1
|/ / / / / /