Commit Graph

25368 Commits

Author SHA1 Message Date
Philip Withnall
e66277943d fuzzing: Add copyright/licensing headers to fuzzing files
The files have only been touched by a subset of three people: pdknsk,
Philip Withnall, and Marc-André Lureau. Their copyrights are assigned to
pdknsk, Endless OS Foundation and Red Hat.

The default license for GLib at the time of writing these files was (and
still is) LGPL-2.1-or-later.

`driver.c` came from LLVM and is under a different license:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/fuzzer/standalone/StandaloneFuzzTargetMain.c.
That doesn’t affect the license of GLib overall, since it’s only used
for testing during development.

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

Helps: #1415
2022-05-18 09:49:26 +01:00
Philip Withnall
1771449e54 tests: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files glib/tests/*.c | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

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

Helps: #1415
2022-05-18 09:21:02 +01:00
Philip Withnall
c613d32b92 tests: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/tests/*.c | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

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

Helps: #1415
2022-05-18 09:20:07 +01:00
Philip Withnall
70ee43f1e9 glib: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files glib/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

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

Helps: #1415
2022-05-18 09:19:02 +01:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

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

Helps: #1415
2022-05-18 09:18:52 +01:00
Philip Withnall
25d2925f3f Merge branch 'compiler-toolchain-reqs' into 'main'
docs: Add compiler and toolchain requirements from the wiki

See merge request GNOME/glib!2664
2022-05-18 07:57:46 +00:00
Philip Withnall
54a7e8a3a4 docs: Update supported platforms list
This just updates the list to reflect what we currently have in CI,
rather than any radical changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-18 08:36:50 +01:00
Philip Withnall
446e016923 docs: Formatting improvements to supported-platforms.md
This doesn’t change the content.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-18 08:36:50 +01:00
Philip Withnall
aa60b45ff8 docs: Add compiler and toolchain requirements from the wiki
These files are Markdown-ified versions of the following wiki pages:
 * https://wiki.gnome.org/Projects/GLib/CompilerRequirements
 * https://wiki.gnome.org/Projects/GLib/SupportedPlatforms

Keeping the files in version control with the rest of the documentation
means they should be easier to find, and easier to remember to keep up
to date.

They have not been modified other than to change to Markdown and tweak
the formatting. Content updates to them will be done in future commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-18 08:36:36 +01:00
Sebastian Dröge
d2f1e55a57 Merge branch 'reuse' into 'main'
docs: Initial REUSE licensing support

See merge request GNOME/glib!2663
2022-05-18 06:53:22 +00:00
Emmanuel Fleury
5c32c31489 Remove unnecessary dependency on the slice-color test 2022-05-17 18:35:20 +02:00
Emmanuel Fleury
8ad765a4c2 Convert test/slice-test.c to glib test framework and move it to glib/tests/ 2022-05-17 18:35:16 +02:00
Philip Withnall
31c1641073 docs: Add REUSE-compliant dep5 file for the license of a few directories
This bulk-adds licensing information for a load of test directories and
the `po/` directory, since it’s impractical or impossible to add
licensing information for those files otherwise.

For the test files, in particular, adding the licensing headers would
affect the tests. Adding `.license` files alongside would cause them to
get interpreted by the test runner, which is undesirable.

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

Helps: #1415
2022-05-17 17:23:34 +01:00
Philip Withnall
2dc8184590 tests: Add some SPDX license headers
These cover the files which Debian has already worked out the licensing
information for, in
https://salsa.debian.org/gnome-team/glib/-/blob/debian/master/debian/copyright.

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

Helps: #1415
2022-05-17 17:23:34 +01:00
Philip Withnall
46698ffcbd docs: Add all used licenses in a REUSE-compatible directory
This is the result of running `reuse download --all`.

This isn’t yet necessarily a comprehensive list of all licenses used in
GLib, as the majority of files in GLib are currently missing machine
readable copyright and licensing headers.

It’s a start though.

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

Helps: #1415
2022-05-17 17:23:34 +01:00
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
Philip Withnall
d0e1131397 Merge branch 'wip/pwithnall/meson-cleanups' into 'main'
build: Remove a few Meson workarounds and FIXMEs

See merge request GNOME/glib!2653
2022-05-17 14:13:55 +00:00
Philip Withnall
fa8430d42a Merge branch 'fix_test' into 'main'
Cleaning a file left behind by glib/tests/bookmarkfile.c test case

See merge request GNOME/glib!2659
2022-05-17 14:03:06 +00:00
Philip Withnall
6659f502ca Merge branch 'resources-extraneous-symbol' into 'main'
resources: Hide external data symbol

Closes gtk#4598

See merge request GNOME/glib!2652
2022-05-17 13:58:41 +00:00
Philip Withnall
ab07ee3d3b Merge branch 'mcatanzaro/#2646' into 'main'
Deprecate GDtlsClientConnection validation flags

Closes #2646

See merge request GNOME/glib!2647
2022-05-17 13:39:36 +00:00
Philip Withnall
bc51658167 build: Factor out some size_t checks
With Meson 0.60 (or possibly some earlier versions) we can factor the
checks out as a variable can now be used as an array key. This
simplifies the checks a little, while introducing no functional
differences.

The contents of `g_sizet_compatibility` after this block are identical
with and without the changes applied.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-17 14:04:24 +01:00
Philip Withnall
51c55b44ad build: Use cc.check_header() to check malloc.h
Since Meson 0.47, this can be used to check a header with compilation,
rather than just stat. This removes a workaround.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-17 14:04:24 +01:00
Philip Withnall
768c87697e build: Specify all inputs to concat-files-helper.py
Since Meson 0.52, a list of inputs is correctly supported, so our
workaround can be removed.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-17 14:04:24 +01:00
Matthias Clasen
6039c1f4e8 resources: Hide external data symbol
Apply --internal to the symbol for the section as well.

Only do this with --external-data, since otherwise gcc
will complain about ignoring the attribute.

This fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4598
2022-05-17 14:04:11 +01:00
Michael Catanzaro
e27ef839d9 Deprecate GDtlsClientConnection validation flags
See !2214 for motivation. It doesn't work properly anymore, and the TLS
versions of these functions were already deprecated. Sadly, I missed the
DTLS versions.

Fixes #2646
2022-05-17 14:03:28 +01:00
Philip Withnall
848d7718b6 Merge branch 'test-slice-threadinit' into 'main'
Moving slice-threadinit.c test to glib/tests/

See merge request GNOME/glib!2580
2022-05-17 12:59:45 +00:00
Philip Withnall
5efbd51ea8 Merge branch 'cleanup-root' into 'main'
Various updates to documentation and misc files in the root directory

See merge request GNOME/glib!2649
2022-05-17 12:58:25 +00: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
Ignacio Casal Quinteiro
acb1ce2272 win32appinfo: change log level from warning to debug
There is nothing that the user can do anyway and this dumps
lots of warnings without real need.

Closes #2640
2022-05-17 12:14:21 +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
Emmanuel Fleury
92a6db39de Cleaning a file left behind by glib/tests/bookmarkfile.c test case 2022-05-16 19:13:52 +02:00
Emmanuel Fleury
ddb0585e65 Moving slice-threadinit.c test to glib/tests/
Related to issue #1434
2022-05-16 15:21:02 +02:00
Emmanuel Fleury
a83ccbd251 Convert tests/slice-threadinit.c to glib test framework 2022-05-16 15:20:27 +02: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
Nicola Fontana
a84068d12a gspawn: Avoid considering out parameters as inputs
The g_spawn_async_with_pipes_and_fds() API changes its behavior
depending on the states of out parameters. Apart from the philosophical
inconsistency, this poses some real problems, e.g. in Lua bindings:

    https://github.com/lgi-devs/lgi/issues/277

This adds three new spawn flags to allow specifying the wanted behavior
explicitly and does not assert on the state of the output parameters.
2022-05-16 15:05:59 +02: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