Commit Graph

30249 Commits

Author SHA1 Message Date
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
L. E. Segovia
06ea9aed58 glib/gthread-posix: Block futex_time64 usage on Android API level < 30
This syscall is seccomp blocked on all lower API levels:

ee7bc3002d
2024-04-02 00:00:21 -03:00
Rachida SACI
e9cd534a14 Update Kabyle translation
(cherry picked from commit 573bce8187)
2024-04-02 00:18:32 +00:00
Philip Withnall
2cee8e3d06 Merge branch 'port-gaction-comments-2' into 'main'
Port the remaining documentation comments in `gio/gaction.c` to GI-Docgen

See merge request GNOME/glib!3986
2024-04-01 15:33:54 +00:00
Sudhanshu Tiwari
57d6b945f1 Ported the remaining documentation comments in gio/gaction.c to GI-Docgen 2024-04-01 16:00:23 +01:00
Philip Withnall
e46f2347d2 Merge branch 'style/spelling' into 'main'
docs: spelling and grammar fixes

See merge request GNOME/glib!3990
2024-04-01 14:13:19 +00:00
Philip Withnall
ccc6867391 Merge branch 'fix/gsettings-completion-unset-schemadir' into 'main'
completion: make gsettings work in nounset mode

See merge request GNOME/glib!3989
2024-04-01 14:04:37 +00:00
Philip Withnall
ef461fb391 gsubprocess: Globally ignore SIGPIPE
Just like we already do in `GSocket`.

This is necessary when using `g_subprocess_communicate()` with a
subprocess which calls `close()` on its stdin FD at some point. `cat`
does this just before exiting, for example.

This causes a `write()` to the stdin pipe in the parent process to fail
with `EPIPE` and `SIGPIPE`. The condition is not detectable in advance,
because the `close()` call could happen after the `GMainContext` has
dispatched a `g_subprocess_communicate()` callback.

If it weren’t for the `SIGPIPE`,`g_subprocess_communicate()` would be
able to handle the `EPIPE` just fine. `SIGPIPE` seems like a default
error handling path which was useful in 1980 for writing pipe-heavy
command line apps, but which is more of a broken stair for writing
larger modern apps which have more than one data flow path.

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

Fixes: #3310
2024-04-01 14:41:33 +01:00
Ville Skyttä
b20647c2e2 docs: spelling and grammar fixes
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2024-04-01 11:01:06 +00:00
Ville Skyttä
bf1508fa76 completion: make gsettings work in nounset mode
With the shell in nounset mode, an error is emitted on referencing
`schemadir` as it is not initialized in all code paths.

Initialize to an empty string to fix.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2024-04-01 10:31:34 +00:00