Commit Graph

27012 Commits

Author SHA1 Message Date
Philip Withnall
ac30b7d824 Merge branch 'leak-fix' into 'main'
tests/desktop-app-info: fix stack-use-after-scope

See merge request GNOME/glib!3187
2023-01-26 15:36:22 +00:00
Philip Withnall
c53f9c0d37 gappinfo: Document that g_app_info_get_executable() should not be spawned
Spawning a process correctly is a lot more complicated than just bunging
an argument onto the return value from this function.

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

Helps: #2901
2023-01-26 14:54:35 +00:00
Philip Withnall
287314c5a9 Merge branch 'regex-escape-string-bad-gir' into 'main'
g_regex_escape_string: bad GIR: utf8[] -> utf8

See merge request GNOME/glib!3236
2023-01-26 14:47:13 +00:00
Philip Withnall
34f5fa046a Merge branch 'fix_wspawnve' into 'main'
Fix safe_wspawnve #define

Closes #2900 and gimp#9094

See merge request GNOME/glib!3237
2023-01-26 14:25:03 +00:00
Emmanuele Bassi
2974cf272a Merge branch 'bad-gir-gunichar-array' into 'main'
Fix GIR: gunichar -> gunichar[]

See merge request GNOME/glib!3238
2023-01-26 14:03:18 +00:00
Bart Jacobs
4e1fe6cf22 Fix GIR: gunichar -> gunichar[] 2023-01-26 11:27:31 +00:00
Hernan Martinez
4c4448debd Fix safe_wspawnve #define 2023-01-26 10:23:41 +00:00
Bart Jacobs
2f0ec59c4a g_regex_escape_string: bad GIR: utf8[] -> utf8 2023-01-26 10:18:05 +00:00
Philip Withnall
828030a6b2 Merge branch 'io-channel-get-line-term-bad-gir' into 'main'
g_io_channel_get_line_term: add (out) annotation

Closes #2895

See merge request GNOME/glib!3232
2023-01-25 18:54:30 +00:00
Marco Trevisan (Treviño)
50204abda6 gstring: Cleanup some macro definitions 2023-01-25 17:28:09 +01:00
Marco Trevisan (Treviño)
4ca90af6ed gstring: Gracefully handle NULL parameters in inline append
We could have unguarded crashes when calling strlen (NULL) or when passing
invalid GString's.

Also ensure that we are not using the macro `val` argument multiple times as
it may lead to an unwanted behavior when passing to it a variable value such
as `str[++i]`, as the value may be called multiple times.
C++ tests and Coverity were both underlining this.

Fixes: #2890
2023-01-25 17:27:51 +01:00
Philip Withnall
636d4a587a Merge branch 'time-zone-adjust-time-bad-gir' into 'main'
g_time_zone_adjust_time: add (inout) annotation

Closes #2897

See merge request GNOME/glib!3230
2023-01-25 15:27:26 +00:00
Bart Jacobs
0815be81ce g_io_channel_get_line_term: add (optional) annotation 2023-01-25 14:49:30 +00:00
Philip Withnall
8b76267787 Merge branch 'fix_2894' into 'main'
GValue: document ownership transfer in g_value_take_string

Closes #2894

See merge request GNOME/glib!3228
2023-01-25 14:41:05 +00:00
Bart Jacobs
f87475ea87 g_io_channel_get_line_term: add (out) annotation
Fixes #2895
2023-01-25 14:30:23 +00:00
Bart Jacobs
92e34c86da g_time_zone_adjust_time: add (inout) annotation
Fixes #2897 .
2023-01-25 15:19:07 +01:00
Hugo Carvalho
8a9bfa0b62 Update Portuguese translation 2023-01-25 14:16:41 +00:00
Philip Withnall
0f7797d76d Merge branch 'remove-gslice-allocator' into 'main'
gslice: remove slice allocator

Closes #1079

See merge request GNOME/glib!2935
2023-01-25 14:09:58 +00:00
Lukáš Tyrychtr
fce798661d GValue: document ownership transfer in g_value_take_string
Fixes #2894
2023-01-25 14:49:57 +01:00
Philip Withnall
41416c9fe6 tests: Drop unnecessary GSlice tests
Now that the implementation of GSlice has been dropped, these tests for
the internals of the implementation are unnecessary.

We can keep `glib/tests/slice.c` as it tests the API rather than the
implementation.

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

Helps: #1079
2023-01-25 13:49:09 +00:00
Natanael Copa
7e4b8dfb82 glib/tests: Drop debug build of slice test 2023-01-25 13:49:09 +00:00
Natanael Copa
45b5a6c1e5 gslice: Remove slice allocator and use malloc() instead
Keep the API for ABI compatibility.

See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2935#note_1650099
for a summary of the reasoning for this change:
 - The performance of system-provided allocators has improved since
   GSlice was written, and they are now similarly as performant, or more
   performant, than GSlice.
 - The code is unmaintained and nobody understands it.
 - It doesn’t integrate with tooling and system security features which
   have been written for the system `malloc()` implementation (such as
   sanitisers, valgrind, etc.).
 - It’s confusing for developers: should they use `g_slice_new()` or
   `g_new()`?
 - GSlice is faster than the libc allocator for allocating and
   (particularly) freeing linked lists, but since these are a rubbish
   data structure, that’s not a great thing to optimise for.

For the cases where application performance is negatively impacted by
the implementation of GSlice being dropped (and we don’t think there’ll
be many), applications can use a drop-in `malloc()` replacement which is
more suited to their particular workload. Choosing an allocator in GLib
to suit all application workloads is not possible.

Including documentation updates and cleanups by Philip Withnall.

Fixes: #1079
2023-01-25 13:49:09 +00:00
Philip Withnall
6facddac02 Merge branch 'socket-reuse-tests' into 'main'
tests: Temporarily disable socket test due to a kernel bug

See merge request GNOME/glib!3225
2023-01-25 12:49:42 +00:00
Yosef Or Boczko
65f660914a Update Hebrew translation 2023-01-25 08:16:51 +00:00
Emin Tufan Çetin
7bfbf0e17c Update Turkish translation 2023-01-24 23:47:23 +00:00
Simon McVittie
4dc99db8ad Merge branch 'coverity-test-logging' into 'main'
gtestutils: Fix a potential NULL pointer dereference in g_test_log()

See merge request GNOME/glib!3224
2023-01-24 19:50:25 +00:00
Marc-André Lureau
f50a4f8501 tests/desktop-app-info: fix stack-use-after-scope
Fix the tests, by allocating the structure.

==121338==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffe44018610 at pc 0x00000040ff71 bp 0x7ffe440178f0 sp 0x7ffe440178e8
READ of size 8 at 0x7ffe44018610 thread T0
    #0 0x40ff70 in test_launch_uris_with_terminal ../gio/tests/desktop-app-info.c:1393
    #1 0x7efd97b831e8 in test_case_run ../glib/gtestutils.c:2947
    #2 0x7efd97b831e8 in g_test_run_suite_internal ../glib/gtestutils.c:3037
    #3 0x7efd97b82d23 in g_test_run_suite_internal ../glib/gtestutils.c:3056
    #4 0x7efd97b82d23 in g_test_run_suite_internal ../glib/gtestutils.c:3056
    #5 0x7efd97b82d23 in g_test_run_suite_internal ../glib/gtestutils.c:3056
    #6 0x7efd97b84189 in g_test_run_suite ../glib/gtestutils.c:3136
    #7 0x7efd97b842c5 in g_test_run ../glib/gtestutils.c:2248
    #8 0x4055bc in main ../gio/tests/desktop-app-info.c:1901
    #9 0x7efd9564a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
    #10 0x7efd9564a5c8 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x275c8)
    #11 0x4059f4 in _start (/home/elmarco/src/gnome/glib/build/gio/tests/desktop-app-info+0x4059f4)

Address 0x7ffe44018610 is located in stack of thread T0 at offset 128 in frame
    #0 0x404d1f in main ../gio/tests/desktop-app-info.c:1823

  This frame has 6 object(s):
    [48, 52) 'argc' (line 1821)
    [64, 72) 'path' (line 1870)
    [96, 104) 'argv' (line 1822)
    [128, 144) '<unknown>' <== Memory access at offset 128 is inside this variable
    [160, 176) '<unknown>'
    [192, 288) 'supported_terminals' (line 1825)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-01-24 23:43:20 +04:00
Philip Withnall
1507585869 tests: Temporarily disable socket test due to a kernel bug
There’s a kernel bug on the CI machines which is causing this test to
fail all the time and it’s getting my goat.

The test can be re-enabled later (by reverting this commit) when the
kernel on the CI VM host is fixed. I don’t know when that’s going to
happen.

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

Helps: #2879
2023-01-24 11:46:25 +00:00
Philip Withnall
2676ef03cc gtestutils: Fix a potential NULL pointer dereference in g_test_log()
Although unlikely, apparently `message` may be `NULL` (the rest of the
code checks for it), so the code to convert newlines to spaces should
probably also check for `NULL`.

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

Coverity CID: #1504054
2023-01-24 11:33:18 +00:00
Philip Withnall
73205b8bbd tests: Explicitly remove a timeout handler in gapplication test
Otherwise if, for whatever reason, the `app` loses its D-Bus name,
`g_application_quit()` is called from `name_was_lost()` before it’s
called from `quit_already()`, and then `quit_already()` does an invalid
read on `app`.

If the name was not meant to be lost at this point in the test, the
subsequent `g_assert_false (name_lost)` will catch that, so this change
shouldn’t cause the test to pass unnecessarily.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-01-24 11:25:34 +00:00
Philip Withnall
90af624d5b glib.supp: Add suppression for the one-time allocation in g_get_tmp_dir()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-01-24 11:20:35 +00:00
Philip Withnall
41bd0fddcd glib.supp: Further ignore system thread allocations
This should stop the following valgrind error:
```
==14506== 80 bytes in 1 blocks are definitely lost in loss record 1,098 of 1,463
==14506==    at 0x484086F: malloc (vg_replace_malloc.c:381)
==14506==    by 0x48C5D83: g_malloc (gmem.c:130)
==14506==    by 0x48E7911: g_slice_alloc (gslice.c:1074)
==14506==    by 0x48E7951: g_slice_alloc0 (gslice.c:1100)
==14506==    by 0x493617D: g_system_thread_new (gthread-posix.c:1188)
==14506==    by 0x48F9EAA: g_thread_new_internal (gthread.c:935)
==14506==    by 0x48F9E29: g_thread_try_new (gthread.c:919)
==14506==    by 0x48FA351: g_thread_pool_spawn_thread (gthreadpool.c:312)
==14506==    by 0x48F9D2C: g_thread_proxy (gthread.c:831)
==14506==    by 0x4EFA2A4: start_thread (in /usr/lib64/libpthread-2.33.so)
==14506==    by 0x4D89322: clone (in /usr/lib64/libc-2.33.so)
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-01-24 11:20:04 +00:00
Philip Withnall
20c4fcb2a7 Merge branch '2891-2892-win32-leaks' into 'main'
gwin32: Fix two minor string leaks

Closes #2891 and #2892

See merge request GNOME/glib!3222
2023-01-23 12:54:16 +00:00
Philip Withnall
e23ea40aaa gwin32: Fix two minor string leaks
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2891, #2892
2023-01-23 11:50:34 +00:00
Sabri Ünal
34c5a689b5 Update Turkish translation 2023-01-22 19:15:45 +00:00
Michael Catanzaro
ce876ab28b Merge branch 'threadpool-shared-thread-prios' into 'main'
GThreadPool: Always use the thread-spawning thread for the global shared thread pool

Closes #2769

See merge request GNOME/glib!3208
2023-01-20 19:00:49 +00:00
Vasil Pupkin
1be25e6015 Update Belarusian translation 2023-01-20 16:55:45 +00:00
Philip Withnall
e86e559a0f Merge branch 'meson-use-tap-protocol-improvements' into 'main'
TAP: some further cleanups

See merge request GNOME/glib!3221
2023-01-20 15:24:50 +00:00
Marco Trevisan (Treviño)
a8f56c5be1 ci: Use verbose output in meson by default
Now that we're using TAP parsing, this will show subtest failures in
details but without showing any logging error, that we'd still need to parse
from actual logs.
2023-01-20 15:41:17 +01:00
Marco Trevisan (Treviño)
a707cebcd9 gtestutils: Improve TAP reporting on tests failures
When we've a failure our TAP reporting just bails out without that is clear
what is the test that has failed.

So in this case, expose a "not ok" message if the test name is known, and
use it to report the error message too if available.

Otherwise just use the same Bail out! strategy.
2023-01-20 15:28:58 +01:00
Marco Trevisan (Treviño)
d8e4c1a8f8 gtestutils: Do not make a subtest to Bail out! the root one
This is something that a base test should decide, so if a subtest fails it's
up to the caller to decide whether to bail out the whole suite or just the
subtest.
2023-01-20 15:27:27 +01:00
Marco Trevisan (Treviño)
f5f09445b8 gtestutils: Define TAP version clearly as defined value
As we do in tests
2023-01-20 15:23:59 +01:00
Philip Withnall
e6fbd2afa6 Merge branch 'meson-use-tap-protocol' into 'main'
meson: Use 'tap' test protocol and support TAP 13/14

See merge request GNOME/glib!3140
2023-01-20 13:45:12 +00:00
Marco Trevisan (Treviño)
6a4f6c593c gsettings: Skip tests in the proper way
This will make TAP happier in reporting what's wrong
2023-01-20 14:10:08 +01:00
Marco Trevisan (Treviño)
03f5d0b060 gtestutils: Use test print handler to write subprocess output
When using verbose logging, all the printing and the glib info and debug
logs may end up being written in standard out, making meson TAP parser to be
confused and to fail with TAP parsing errors.

So, in such case write the subprocess output all at once using the the gtest
printer so that we add proper formatting.

Also do not write any gtest result message for subprocesses
2023-01-20 14:10:08 +01:00
Marco Trevisan (Treviño)
8b7b5f5457 gtestutils: Define a custom g_print handler for TAP
When using TAP output in gtest, all the printed strings should be commented
not to break the spec, so enforce this at GTest level, by ensuring that
all the lines written via g_print() will be in the commented form and will
respect the subtest indentation.

As per this we can remove some custom code in g_test_log() as now there are
very few cases in which we need to use the default print handler which is
now private when testing.
2023-01-20 14:10:08 +01:00
Marco Trevisan (Treviño)
3d1736c828 gmessages: Make print handler functions to return default handlers
g_set_print_handler() and g_set_printerr_handler() are supposed to return
the old printer handlers, but in case the default is used NULL is returned
instead.

This makes hard to override the default handler to e.g. decorate the output
with some minor content, without having to rewrite the low-level
implementation.

So, make the default printers to be functions and set them as the default
ones. Also this avoids having to check each time what function to use at
print time.
2023-01-20 14:06:23 +01:00
Marco Trevisan (Treviño)
5d91834d9b gtestutils: Do not generate the random seed if provided
There's no point to generate a seed if we're going to overwrite it when
--seed is used.
2023-01-20 14:06:23 +01:00
Marco Trevisan (Treviño)
871c4b4698 spawn-test-win32-gui: Write state to stderr
Makes TAP happier
2023-01-20 14:06:23 +01:00
Marco Trevisan (Treviño)
1daf05ecda gpoll: Print results to stderr
This will make it compatible with TAP reporting.
2023-01-20 14:06:23 +01:00