Commit Graph

25124 Commits

Author SHA1 Message Date
Marc-André Lureau
bb890b57d2 gobject/gsignalgroup: fix memory leaks on error
Spotted by ASAN during the tests:

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7ff0b4562077 in calloc (/lib64/libasan.so.8+0xba077)
    #1 0x7ff0b3e8b508 in g_malloc0 ../glib/gmem.c:155
    #2 0x7ff0b375052f in g_closure_new_simple ../gobject/gclosure.c:220
    #3 0x7ff0b375b422 in g_cclosure_new ../gobject/gclosure.c:976
    #4 0x7ff0b37d159e in g_signal_group_connect_full ../gobject/gsignalgroup.c:790
    #5 0x7ff0b37d159e in g_signal_group_connect ../gobject/gsignalgroup.c:886
    #6 0x4045d8 in test_signal_group_invalid ../gobject/tests/signalgroup.c:331
    #7 0x7ff0b3f369a5 in test_case_run ../glib/gtestutils.c:2930
    #8 0x7ff0b3f369a5 in g_test_run_suite_internal ../glib/gtestutils.c:3018
    #9 0x7ff0b3f364ed in g_test_run_suite_internal ../glib/gtestutils.c:3035
    #10 0x7ff0b3f364ed in g_test_run_suite_internal ../glib/gtestutils.c:3035
    #11 0x7ff0b3f37879 in g_test_run_suite ../glib/gtestutils.c:3112
    #12 0x7ff0b3f37995 in g_test_run ../glib/gtestutils.c:2231
    #13 0x40253c in main ../gobject/tests/signalgroup.c:664
    #14 0x7ff0b2de758f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f012addf077 in calloc (/lib64/libasan.so.8+0xba077)
    #1 0x7f012a708508 in g_malloc0 ../glib/gmem.c:155
    #2 0x7f0129fcd52f in g_closure_new_simple ../gobject/gclosure.c:220
    #3 0x7f0129fd8422 in g_cclosure_new ../gobject/gclosure.c:976
    #4 0x7f012a04e5ae in g_signal_group_connect_full ../gobject/gsignalgroup.c:791
    #5 0x7f012a04e5ae in g_signal_group_connect ../gobject/gsignalgroup.c:887
    #6 0x4043cc in test_signal_group_invalid ../gobject/tests/signalgroup.c:308
    #7 0x7f012a7b39a5 in test_case_run ../glib/gtestutils.c:2930
    #8 0x7f012a7b39a5 in g_test_run_suite_internal ../glib/gtestutils.c:3018
    #9 0x7f012a7b34ed in g_test_run_suite_internal ../glib/gtestutils.c:3035
    #10 0x7f012a7b34ed in g_test_run_suite_internal ../glib/gtestutils.c:3035
    #11 0x7f012a7b4879 in g_test_run_suite ../glib/gtestutils.c:3112
    #12 0x7f012a7b4995 in g_test_run ../glib/gtestutils.c:2231
    #13 0x40253c in main ../gobject/tests/signalgroup.c:664
    #14 0x7f012966458f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
15ce3c9b37 glib/tests/spawn-path-search: fix stack-buffer-overflow
==24477==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffde020de20 at pc 0x7f2e6f6413f1 bp 0x7ffde020c9d0 sp 0x7ffde020c180
READ of size 4101 at 0x7ffde020de20 thread T0
    #0 0x7f2e6f6413f0 in __interceptor_strlen.part.0 (/lib64/libasan.so.8+0x4c3f0)
    #1 0x7f2e6ef4abee in g_build_path_va ../glib/gfileutils.c:1908
    #2 0x7f2e6f085956 in g_test_build_filename_va ../glib/gtestutils.c:4294
    #3 0x7f2e6f086684 in g_test_build_filename ../glib/gtestutils.c:4365
    #4 0x403a33 in test_search_path_heap_allocation ../glib/tests/spawn-path-search.c:422
    #5 0x7f2e6f0839a5 in test_case_run ../glib/gtestutils.c:2930
    #6 0x7f2e6f0839a5 in g_test_run_suite_internal ../glib/gtestutils.c:3018
    #7 0x7f2e6f0834ed in g_test_run_suite_internal ../glib/gtestutils.c:3035
    #8 0x7f2e6f084879 in g_test_run_suite ../glib/gtestutils.c:3112
    #9 0x7f2e6f084995 in g_test_run ../glib/gtestutils.c:2231
    #10 0x40145f in main ../glib/tests/spawn-path-search.c:488
    #11 0x7f2e6e31258f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f)
    #12 0x7f2e6e312648 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x2d648)
    #13 0x401524 in _start (/home/elmarco/src/gnome/glib/build/glib/tests/spawn-path-search+0x401524)

Address 0x7ffde020de20 is located in stack of thread T0 at offset 4256 in frame
    #0 0x40387f in test_search_path_heap_allocation ../glib/tests/spawn-path-search.c:401

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
984103b0e7 gio/tests: add gdbus-peer test to win32
Because we can :)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
7886283750 gio/tests: unescape the nonce_file value
The raw value is escaped according to D-Bus rules. This is probablematic
for Windows backslashed paths. We can use URI unescaping, it seems
that's what gdbusaddress.c is doing too.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
e34795b431 gio/gdbusserver: add "unix:" address support on !unix
This is another minor left-over after GNOME/glib!2445.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
18886d43d2 gio/gdbusauth: remove #ifdef G_OS_UNIX around credentials
The AF_UNIX API is available under all platforms since 2.71.1, and
credentials functions returns NOT_SUPPORTED error appropriately,
we can thus remove the special-casing for !unix.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
b5c97b1016 gio/tests: add basic fd-list unit test to unix-fd
To cover win32 support.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 17:34:06 +02:00
Marc-André Lureau
c9b5b1fb94 gio/tests: switch to g_close()
For the better behaviour and portability.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 16:37:39 +02:00
Marc-André Lureau
b8eb64b350 gio/tests: add unix-fd test to win32
The "/unix-fd/scm" test is quite Unix-specific, the next patch is going
to add a portable test.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 16:37:39 +02:00
Marc-André Lureau
5efb84f24a gio: add GUnixFDList on win32
FDs are not specific to Unix. win32 has APIs to map CRT fd to/from HANDLE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-17 14:39:20 +02:00
Sebastian Dröge
5eaa13f573 Merge branch 'hmac-signedness' into 'main'
ghmac: Fix some signed/unsigned issues with g_checksum_update()

See merge request GNOME/glib!2636
2022-05-17 07:28:05 +00:00
Sebastian Dröge
68574bd130 Merge branch 'wip/pwithnall/io-channel-double-close-source' into 'main'
tests: Fix a double-close of a GSource in tests

See merge request GNOME/glib!2658
2022-05-17 07:22:41 +00:00
Philip Withnall
7137591775 tests: Fix a double-close of a GSource in tests
This bug only gets triggered on BSD, because it calls `recv_message()`
with `G_IO_HUP | G_IO_IN`. That takes two code paths in
`recv_message()`, and ends up calling `shutdown_source()` twice. The
second call causes a critical warning.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/jobs/2004192

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-16 14:12:30 +01:00
Philip Withnall
6ad8205949 Merge branch 'nacho/gtask-performance' into 'main'
gtask: use g_strconcat() in g_task_return() only if needed

See merge request GNOME/glib!2654
2022-05-16 12:52:01 +00:00
Philip Withnall
5160b12740 Merge branch 'move_thread_test' into 'main'
Move tests/thread-test.c to glib/tests/thread-deprecated.c

See merge request GNOME/glib!2639
2022-05-16 12:41:25 +00:00
Philip Withnall
d1bec29217 Merge branch 'move_gio-test' into 'main'
Convert tests/gio-test.c to g_test framework

See merge request GNOME/glib!2539
2022-05-16 12:34:27 +00:00
Ignacio Casal Quinteiro
f38d74b233 gtask: use g_strconcat() in g_task_return() only if needed
If the task name is NULL there is no need to allocate the string
since this can be expensive if called very often
2022-05-16 13:25:50 +01:00
Philip Withnall
82766ae446 Merge branch 'wip/pwithnall/disable-macos-ci' into 'main'
ci: Temporarily allow failure of macOS CI runner until it’s fixed

See merge request GNOME/glib!2657
2022-05-16 12:24:52 +00:00
Philip Withnall
e3673202e2 ci: Temporarily disable macOS CI runner until it’s fixed
The runner machine is offline and there is no ETA on when it will be
back, so disable the CI job which uses it for now so that pipelines
can proceed.

See https://gitlab.gnome.org/Infrastructure/GitLab/-/issues/558

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-16 13:01:36 +01:00
Fran Dieguez
bd82c8d1d1 Update Galician translation 2022-05-16 07:58:53 +00:00
Xavier Claessens
5718d15af7 Merge branch 'fix-meson' into 'main'
Fix typo in gio/meson.build

Closes gtk#4918

See merge request GNOME/glib!2655
2022-05-14 13:23:17 +00:00
Godvin Ouseph
61ad2d7217 Fix typo in gio/meson.build
This broke compiling gtk4 as a subproject on Windows
2022-05-14 15:54:56 +05:30
Philip Withnall
9c9a26215d Merge branch 'win32-socket' into 'main'
Various socket-related fixes for win32

See merge request GNOME/glib!2599
2022-05-13 10:25:23 +00:00
Marc-André Lureau
960ed2f906 glib/tests: add spawn-stderr-socket test
Check the spawn implementation behaviour when the stderr is a
socket (mostly for win32).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:54:11 +02:00
Marc-André Lureau
a34a4e7844 glib/win32: teach reopen_noninherited() about SOCKET
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:54:11 +02:00
Marc-André Lureau
277657eacc glib/win32: introduce private g_win32_handle_is_socket()
Used in following commits, including in some GIO experiments.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:54:11 +02:00
Marc-André Lureau
c43472060b glib/win32: replace reopen_noninherited()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:49:00 +02:00
Marc-André Lureau
c984db650f glib/win32: introduce private g_win32_reopen_noninherited()
Used in following commits, including in some GIO experiments, so make it
a private API.

For now, this implementation is similar to the glib/gspawn-win32.c one,
with mroe error checking and better on error behaviour. A following
patch will also fix the case of duplicating sockets.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:49:00 +02:00
Marc-André Lureau
982b074fa9 glib/win32: fix potential leak on spawn error
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Marc-André Lureau
e84b05a8c3 glib/win32: drop needless #ifdef G_OS_WIN32
They were carried over from an ancient time.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Marc-André Lureau
c4a7ddbf67 gio/tests/unix-fd: rename test
Use a prefix matching the binary, rename the test "scm", as it involves
SocketControlMessage.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Marc-André Lureau
18d98e30f9 gio/tests: close leaked fd
Also fixes some of the test on win32, since it won't delete files that
are opened.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Marc-André Lureau
a638b2bbd1 gio: include Unix socket headers
This should have been part of #2487.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Marc-André Lureau
d1520bd06e glib/tests: move spawn-test-win32-gui
Fixes: commit 762ed2e82b ("Move tests/spawn-test.c -> glib/tests/spawn-test.c")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-12 18:48:59 +02:00
Emmanuel Fleury
87a4cea9e4 Convert g_printf() to g_test_message() to capture messages on TAP 2022-05-12 17:25:07 +02:00
Emmanuel Fleury
4589ff080d Move test/gio-test.c to glib/test/io-channel-basic.c
Helps issue #1434
2022-05-12 17:25:07 +02:00
Emmanuel Fleury
38e0781ba7 Convert deprecated GTimeVal to GDateTime in tests/gio-test.c 2022-05-12 17:25:05 +02:00
Emmanuel Fleury
dbe8e52bde Convert tests/gio-test.c to g_test framework 2022-05-12 17:20:46 +02:00
Philip Withnall
da2702646c Merge branch 'format-codegen' into 'main'
Replace single quotes in gio/tests/codegen.py

See merge request GNOME/glib!2651
2022-05-12 10:24:54 +00:00
Philip Withnall
24909d5e04 Merge branch 'meson-range' into 'main'
meson: Use range() instead of listing all stable versions

See merge request GNOME/glib!2650
2022-05-12 09:53:02 +00:00
TestingPlant
a5e7156a9b Replace single quotes in gio/tests/codegen.py
This makes the formatting more consistent.
2022-05-12 00:29:44 +00:00
Xavier Claessens
5942103937 meson: Use range() instead of listing all stable versions
Note that range(), like in python, has start value included and stop
value excluded. That's why we use last_version + 2.
2022-05-11 14:34:00 -04:00
Sebastian Dröge
06309d50ea Merge branch 'coc' into 'main'
docs: Add a code of conduct document

See merge request GNOME/glib!2648
2022-05-11 11:46:19 +00:00
Philip Withnall
8b6888a6ed docs: Add a code of conduct document
This encodes what GLib is already bound by, as it’s hosted on
gitlab.gnome.org, which is GNOME infrastructure and hence bound by the
GNOME code of conduct.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-11 12:30:58 +01:00
Philip Withnall
9a1b0f17d8 Merge branch 'ci-android' into 'main'
ci: Update to latest Android NDK

Closes #2605

See merge request GNOME/glib!2623
2022-05-11 10:11:11 +00:00
Xavier Claessens
3a8622c9e1 ci: Update to latest Android NDK
Move the NDK in the common Fedora image, better have 1 bigger image that
gets cached into runners. It is also less images to maintain.

Fixes: #2605
2022-05-11 10:52:19 +01:00
Pawan Chitrakar
d59f2efbdd Update Nepali translation
(cherry picked from commit f48e0a91a5)
2022-05-11 07:32:40 +00:00
Philip Withnall
2f73cc670c Merge branch 'mapping-test' into 'main'
Moving tests/mapping-test.c to glib/test/mapping.c

See merge request GNOME/glib!2607
2022-05-10 18:05:07 +00:00
Philip Withnall
5eaf305d2e Merge branch 'expand_ghook_tests' into 'main'
Expand ghook unit tests for a better coverage and add more checks

See merge request GNOME/glib!2624
2022-05-10 17:55:24 +00:00
Emmanuel Fleury
3f085d1f4a Moving tests/mapping-test.c to glib/test/mapping.c
Helps issue #1434
2022-05-10 19:23:14 +02:00