Commit Graph

30308 Commits

Author SHA1 Message Date
Michael Catanzaro
e831627881 Merge branch '3310-subprocess-sigpipe' into 'main'
gsubprocess: Globally ignore SIGPIPE

Closes #3310

See merge request GNOME/glib!3991
2024-04-15 15:33:00 +00:00
Emmanuele Bassi
ac77a3b09f Merge branch 'coc' into 'main'
docs: Update Code of Conduct URI

See merge request GNOME/glib!4008
2024-04-15 15:12:58 +00:00
John Ralls
8c842792a9 glib/tests/unix: Only check for SA_NOCLDSTOP on SIGCHLD 2024-04-15 17:12:28 +02:00
Marco Trevisan (Treviño)
137db219a7 gmain: Use alternate signal stack if the application provides one
Some applications, toolkits or languages may define an alternative stack
to use for traces. This is for example the case of go.

So, in case an application defines an alternate signal stack, GLib should
use that instead of the default one to receive signals otherwise it may
break the application expectations and write where it's not allowed to.
2024-04-15 17:06:05 +02:00
Philip Withnall
57343f48ff
docs: Update Code of Conduct URI
It’s the same document, just in a different place.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 20:36:29 +01:00
Philip Withnall
c844abc759
ci: Force-enable -Dglib_debug for scan-build jobs
Several of the assertions in GLib (particularly on hot paths in
`gobject.c`) are protected behind `#if G_ENABLE_DEBUG`. In order for
scan-build to see them, the scan-build CI job needs to make sure that
a debug build is definitely enabled — not just rely on it being
implicitly enabled via the combination of other build options.

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

Helps: #1767
2024-04-12 19:35:05 +01:00
Philip Withnall
0814be8bef
gvariant-serialiser: Check offsets array is initialised before using it
When piecewise validating the offset table for a variable sized array,
it’s possible that the offset table (`offsets.array`) won’t actually
have been set by `gvs_variable_sized_array_get_frame_offsets()` iff the
serialised `GVariant` is not in normal form.

Add an additional check to guard against this. This will result in an
empty child variant being returned, as with other error handling paths
in `gvs_variable_sized_array_get_child()`.

This is a true positive spotted by scan-build. Thanks, scan-build.

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

Helps: #1767
2024-04-12 19:27:34 +01:00
Philip Withnall
4b7f6ffe4c
gparamspecs: Fix NULL pointer dereference
I’m not sure exactly how this code is supposed to work, so this might
not be the right fix. But there’s definitely a problem here, and it was
spotted by scan-build.

If `param_value_array_validate()` is entered with
`value->data[0].v_pointer == NULL && aspec->fixed_n_elements`, that `NULL`
will be stored in `value_array` too. `value->data[0].v_pointer` will
then be set to a new non-`NULL` array.

A few lines down, `value_array_ensure_size()` is called on
`value_array` – which is still `NULL` – and this results in a `NULL`
pointer dereference.

It looks like `value->data[0].v_pointer` and `value_array` are used
interchangeably throughout the whole of the function, so assign the new
value of `value->data[0].v_pointer` to `value_array` too.

My guess is that `value_array` is just a convenience alias for
`value->data[0].v_pointer`, because the latter is a real mouthful to
type or read.

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

Helps: #1767
2024-04-12 18:46:13 +01:00
Philip Withnall
96552fc904
gspawn: Fix use of uninitialised FDs on error path
Spotted by scan-build, an actual true positive result from it, and a
fiendish one too.

If any of the calls to `dupfd_cloexec()` (except the final one) fail,
the remainder of the `duped_source_fds` array would have been left
uninitialised.

The code in `out_close_fds` would have then called `g_clear_fd()` on an
uninitialised FD, with unpredictable results.

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

Helps: #1767
2024-04-12 18:46:07 +01:00
Philip Withnall
3c6c60611f
girnode: Simplify NULL node handling
All of the indications in the surrounding code are that `node` should
never be `NULL`, but the error handling for it did actually allow it to
be `NULL` iff its `parent` was also `NULL`.

That made scan-build (kind of legitimately) warn about `NULL` pointer
dereferences of `node`.

Avoid that by unambiguously using an assertion to prevent `NULL` nodes.

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

Helps: #1767
2024-04-12 18:45:59 +01:00
Philip Withnall
ad0532f2bf
xdgmimeglob: Fix a memory leak on a duplicate-entry path
Rather than `strdup()`ing strings when passing them into
`_xdg_glob_list_append()`, `strdup()` them *inside* the function
instead.

This avoids a leak in the case that the list entry (tuple of `data` and
`mime_type`) already exists in the list.

This has been upstreamed as
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/36.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 18:45:52 +01:00
Philip Withnall
ae3bd19108
gresource: Improve resource unregistration performance slightly
Rather than iterating over the list twice: once to find the resource,
and once to re-find its link and delete it, just use
`g_list_delete_link()` to delete what was found.

This has the lovely side-effect of squashing a false positive from
scan-build, which thought there was a use-after-free of `resource` in
the caller, due to `g_resource_unref()` being called on it here.

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

Helps: #1767
2024-04-12 18:45:46 +01:00
Philip Withnall
1ed199a881
tests: Use g_assert_*() rather than g_assert() in gdbus-export tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 18:45:39 +01:00
Philip Withnall
3f30ec86cd
gdbusconnection: Fix user_data leaks on error
There were a couple of functions in `GDBusConnection` which take a
`user_data` argument, but which then leak it if they error out early.

A true positive spotted by scan-build!

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

Helps: #1767
2024-04-12 18:45:31 +01:00
Philip Withnall
6162bccf1f
girffi: Fix ffi_cif leaks on error return paths
Spotted by scan-build.

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

Helps: #1767
2024-04-12 18:45:18 +01:00
Philip Withnall
e45c93da79
girffi: Add hints to indicate ownership transfer into ffi_cif
scan-build thinks that the `atypes` array is leaked, but it’s not.
Ownership is transferred into the `ffi_cif` structure, and it’s
eventually freed in `gi_callable_info_destroy_closure()`.

Try and help the static analysis by adding an explicit ownership
transfer annotation. It probably won’t help.

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

Helps: #1767
2024-04-12 18:45:09 +01:00
Philip Withnall
b8225c905b
gdbusconnection: Ensure out_serial return value is always set
There were some error paths where it wasn’t set, returning an
uninitialised value to the caller.

Spotted by scan-build.

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

Helps: #1767
2024-04-12 18:45:03 +01:00
Philip Withnall
b2f27beb34
build: Enable -Wnull-dereference warning
This enables `NULL` pointer dereference checking in the compiler. This
isn’t as good as static analysis, but it should hopefully catch some
simple errors without too high a false positive rate.

If the false positive rate is too high to be useful, we can always
disable it again.

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

Helps: #1767
2024-04-12 18:44:56 +01:00
Philip Withnall
0f869f3d73
ci: Disable scan-build for copylibs
Eventually, we do want to include them in static analysis (their code is
run in the same process as GLib, after all). But for now, that’s too
much work to get started.

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

Helps: #1767
2024-04-12 18:44:50 +01:00
Philip Withnall
165ae8c8a7
ci: Disable scan-build’s dead code checker
It’s not highlighting severe bugs for us, and currently generates 132
out of 172 of the scan-build reports, so let’s disable it for now.

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

Helps: #1767
2024-04-12 18:44:43 +01:00
Philip Withnall
2dfd9518e1
ci: Exclude tests from scan-build analysis runs
They cause too much noise at the moment. I want to make scan-build
messages fatal, and with 66 of 238 reports coming from the tests,
that’s not currently feasible.

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

Helps: #1767
2024-04-12 18:44:35 +01:00
Philip Withnall
4607dd77a1 Merge branch 'ebassi/drop-unused-cmph-files' into 'main'
Remove unused cmph files

See merge request GNOME/glib!4003
2024-04-12 14:42:52 +00:00
Emmanuele Bassi
52cc4d7b52 Remove unused cmph files
The cmph utility tool is not built, and the licensing of wingetopt.[ch]
is dubious at best.
2024-04-12 15:26:22 +01:00
Philip Withnall
7ec1d6352e Merge branch 'port-gactiongroup-comments' into 'main'
Ports the documentation comments in gio/gactiongroup.c to GI-Docgen

See merge request GNOME/glib!4002
2024-04-12 13:16:36 +00:00
Philip Withnall
978ca4731c
gactiongroup: Add a missing array termination annotation
It might not actually be needed (I haven’t checked if the default is
correct), but it certainly does no harm and makes things explicit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 13:56:20 +01:00
Philip Withnall
3ec4ba4d1b
gactiongroup: Minor copyediting of documentation, comments and warnings
No functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-12 13:56:07 +01:00
Sudhanshu Tiwari
527e696553 Removed an extra new line in gio/gactiogroup.c 2024-04-12 13:55:51 +01:00
Sudhanshu Tiwari
a43ee8991e Ports the documentation comments in gio/gactiongroup.c to GI-Docgen 2024-04-12 13:55:51 +01:00
Sabri Ünal
204a76669b Update Turkish translation 2024-04-09 10:03:13 +00:00
Philip Withnall
62b65f882a Merge branch 'ebassi/object-connect-docs' into 'main'
docs: Fix g_object_connect()'s docblock

See merge request GNOME/glib!3996
2024-04-08 12:05:31 +00:00
Emmanuele Bassi
b37312f7e4 docs: Fix g_object_connect()'s docblock 2024-04-08 12:05:31 +00:00
Philip Withnall
159d51984b Merge branch 'wip/pwithnall/3314-revert-sigaltstack' into 'main'
Revert "gmain: Use alternate signal stack if the application provides one"

See merge request GNOME/glib!4000
2024-04-08 11:41:50 +00:00
Philip Withnall
3bf2875ce4
Revert "gmain: Use alternate signal stack if the application provides one"
This reverts commit 280c8d41fb.

It breaks the unit tests on macOS (see #3314) and no fix has been
forthcoming.

The alternate stack changes can be resubmitted once they include a
working unit test on macOS, as evidently its treatment of alternate
stacks differs from that on Linux, and hence needs testing.

Helps: #3314
2024-04-08 12:26:40 +01:00
Danial Behzadi
3a1b76ad94 Update Persian translation 2024-04-05 13:58:21 +00:00
Danial Behzadi
2f6ca10f60 Update Persian translation
(cherry picked from commit 1debdc6600)
2024-04-05 13:56:58 +00:00
Michael Catanzaro
a69b346dfd Merge branch '3313-bookmark-spec' into 'main'
gbookmarkfile: Fix link to the Desktop Bookmark Specification

Closes #3313

See merge request GNOME/glib!3995
2024-04-03 15:35:48 +00:00
Philip Withnall
73a4485ed4
gbookmarkfile: Fix link to the Desktop Bookmark Specification
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3313
2024-04-03 10:54:22 +01:00
Philip Withnall
3ac632b406 Merge branch 'fix-missing-saved-errno-for-android-30' into 'main'
glib/gthread-posix: Fix missing saved_errno variable in Android's g_futex_simple

See merge request GNOME/glib!3994
2024-04-02 22:37:09 +00:00
L. E. Segovia
bfebf55d18 glib/gthread-posix: Fix missing saved_errno variable in Android's g_futex_simple 2024-04-02 18:45:23 -03:00
Michael Catanzaro
1504c24777 Merge branch 'move-bionic-checks-to-android' into 'main'
Convert  __BIONIC__ usages that check for Android to __ANDROID__

See merge request GNOME/glib!3993
2024-04-02 16:56:18 +00:00
L. E. Segovia
5d08fb2e45 gunixmounts: Fix typo in comment regarding Android API level 2024-04-02 08:48:39 -03:00
L. E. Segovia
9f95946e01 gutils: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:46:33 -03:00
L. E. Segovia
fe8348efb4 glib/gthread-posix: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:45:19 -03:00
L. E. Segovia
e0fca3e7a7 gunixmounts: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:44:58 -03:00
L. E. Segovia
6e0632a29e gmodule-dl: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:44:29 -03:00
L. E. Segovia
6e664dbe33 gmodule: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:43:55 -03:00
L. E. Segovia
0da4b1bf31 gio-launch-desktop, gmessages: Fix journald support using __BIONIC__ to skip support on Android
As per the Bionic docs, this functionality is Android, not bionic specific.

See: https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:40:48 -03:00
Philip Withnall
b907e28454 Merge branch 'fix-futex-time64-usage-android-30' into 'main'
glib/gthread-posix: Block futex_time64 usage on Android API level < 30

See merge request GNOME/glib!3987
2024-04-02 09:10:31 +00:00
L. E. Segovia
049c8e70c8 glib/gthread-posix: Use the config.h macros to detect futex support 2024-04-02 00:00:21 -03:00
L. E. Segovia
ffa639f0b7 glib/gthread-posix: Fix name of the futex_time64(2) test in the Meson log 2024-04-02 00:00:21 -03:00