Commit Graph

27222 Commits

Author SHA1 Message Date
Philip Withnall
6e499764e4 gthreadedresolver: Port to G_DECLARE_FINAL_TYPE
The class and its header are not public, so this should not be an API or
ABI break.

This just simplifies the code a little and allows for easy extension of
the object’s private data in future commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
bf92bae481 gresolver: Add GResolver:timeout property
Without a timeout, some lookup requests can go on forever, typically due
to bugs in underlying systems.

This can have particularly significant effects on the Happy Eyeballs
algorithm in `GSocketClient`, which relies on multiple name lookups as
its first step.

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

Helps: #2866
2023-04-27 12:23:25 +01:00
Philip Withnall
c256af1c2d gthreadedresolver: Add some additional debug prints
These make it a bit easier to track the ongoing resolver tasks, as the
tasks and/or their closures are not tracked in a big list somewhere.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-25 15:35:54 +01:00
Philip Withnall
28b1b9d9c3 Merge branch 'gmain-less-locks' into 'main'
gmain: Avoid some lock/unlock dance during g_main_context_iterate

See merge request GNOME/glib!3235
2023-04-24 10:29:41 +00:00
Philip Withnall
cba49eb6a1 Merge branch 'mutex-tests-more' into 'main'
glib/tests/[rec-]mutex: Allow each thread to work

See merge request GNOME/glib!3389
2023-04-24 10:25:05 +00:00
Philip Withnall
8ee3063721 Merge branch 'pgorszkowski/add_tests_for_g_signal_handlers_disconnect_matched' into 'main'
Test g_signal_handlers_disconnect_matched for G_SIGNAL_MATCH_ID match

See merge request GNOME/glib!3384
2023-04-24 10:20:21 +00:00
Marco Trevisan
103c9ebe3c Merge branch 'gvariant-typo' into 'main'
gvariant: Fix doc for g_variant_new_object_path

See merge request GNOME/glib!3392
2023-04-22 01:13:39 +00:00
Arnaud Rebillout
edb85b99f6 gvariant: Fix doc for g_variant_new_object_path
The parameter is named 'object_path', not 'string'.
2023-04-21 21:56:50 +07:00
Marco Trevisan
9308f2c353 Merge branch 'wip/3v1n0/gio-gmodule-visibility-dep' into 'main'
gmodule: Define a gmodule include dependency and use it in gio modules

Closes #2982

See merge request GNOME/glib!3386
2023-04-21 13:58:50 +00:00
Marco Trevisan
3594d9615b Merge branch 'update-errfmt-in-gunixconnection' into 'main'
Fix error format in gio/gunixconnection.c (part 2)

See merge request GNOME/glib!3390
2023-04-21 12:05:14 +00:00
James Knight
4ae8606b6f Fix error format in gio/gunixconnection.c (part 2)
Update a series of error messages to use `g_set_error_literal` instead
of `g_set_error`. This should prevent `format-nonliteral` compiler
issues when `-Werror` is configured:

    ../gio/gunixconnection.c: In function ‘g_unix_connection_receive_fd’:
    ../gio/gunixconnection.c:183:9: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
      183 |         nscm);
          |         ^~~~
    ../gio/gunixconnection.c:217:20: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
      217 |                    nfd);
          |                    ^~~
    ../gio/gunixconnection.c: In function ‘g_unix_connection_receive_credentials’:
    ../gio/gunixconnection.c:601:24: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
      601 |                        nscm);
          |                        ^~~~

This is similar to a previous change [1] made to `gunixconnection.c`.

[1]: 44b3d5d80445234041f6c59feb89645f7102c3a4

Signed-off-by: James Knight <james.d.knight@live.com>
2023-04-20 23:41:32 -04:00
Emmanuele Bassi
b8466bb54d Merge branch 'wip/3v1n0/macos-add-desktop-app-info' into 'main'
appmonitor: Skip the test under OSX

See merge request GNOME/glib!3388
2023-04-20 16:52:45 +00:00
Marco Trevisan (Treviño)
3aeef671d0 glib/tests/[rec-]mutex: Allow each thread to work
In non-perf mode, we were making only one thread to win the race to increase
the value, but since we're launching more threads anyways let's allow
more of them to have a chance to do something, to make the test more
valuable, even if it's still quick enough.
2023-04-20 17:01:05 +02:00
Marco Trevisan (Treviño)
d296e94559 appmonitor: Skip the test under OSX
Since commit c0ca3f99 this test is strictly depending on GDesktopAppInfo
that is not defined or available in macos, so skip the test as we do for
windows.

We could have done this at meson level too, but keeping it this way is
probably a better reminder that this should be adapted for such scenario
one day™

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2753753
2023-04-20 16:37:32 +02:00
Marco Trevisan
9f3c4ec940 Merge branch 'old-mac-sdk' into 'main'
gio: fix build on older macOS SDKs

See merge request GNOME/glib!3385
2023-04-20 13:12:06 +00:00
Peter Williams
bb19523a0a gio: fix build on older macOS SDKs
The merge request !2848 added code to automatically detect the module
prefix on macOS, with a test for the Mac #define TARGET_OS_OSX. However,
older versions of the SDK (at least 10.11) don't provide this #define,
leading to build failure. If the #define is missing, fall back to
checking TARGET_OS_MAC. On newer SDKs this symbol is also true for
watchOS, etc., but in those situations TARGET_OS_OSX is available.
2023-04-20 08:54:23 -04:00
Emmanuele Bassi
5f9f1104b9 Merge branch 'do-not-redefine-null-c++' into 'main'
gmacros: Do not redefine NULL on C++

Closes #2973

See merge request GNOME/glib!3387
2023-04-20 10:53:41 +00:00
Marco Trevisan (Treviño)
164f199afc gmacros: Do not redefine NULL on C++
Even though having NULL as nullptr should be the standard for newer C++
versions, it may break some headers, so let's not touch it for now.

Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/2973
2023-04-19 23:03:43 +02:00
Marco Trevisan (Treviño)
7d5242d34e gmain: Do not dead-look if calling g_main_loop_run from a GSource
This should fail and warn but not leaving the context acquired and
locked.

Add tests.
2023-04-19 22:52:43 +02:00
Marco Trevisan (Treviño)
f8e440335c gmain: Avoid locking dance in g_main_loop_run()
We do it during initialization, this may be if necessary handled by GCond in
case we need to acquire the lock.
2023-04-19 22:04:13 +02:00
Marco Trevisan (Treviño)
e7c2ead41b gmain: Avoid some lock/unlock dance during g_main_context_iterate
A context iteration we're doing lots of lock/unlocks and that's fine to give
other threads contexts a chance to run, but we're doing it also just to call
other functions that require locking, and this can be avoided.

Other threads can still have a chance to run while releasing the ownership
of the context.
2023-04-19 21:58:22 +02:00
Marco Trevisan
aa72638301 Merge branch 'fix-gsocket-receive-from-annotation' into 'main'
gsocket: Explicitly mark size parameter as (in)

See merge request GNOME/glib!3382
2023-04-19 19:19:41 +00:00
Marco Trevisan (Treviño)
fe38a02c62 gmodule: Define a gmodule include dependency and use it in gio modules
Various gio modules include gmodule.h that requires the
gmodule-visibility.h to be already built.

To make this easier, just provide a dependency and use it where we are
building modules that do not depend on libgio_dep (that already includes
that).

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2982
2023-04-19 21:10:29 +02:00
Anders Jonsson
d4708c180d Update Swedish translation 2023-04-19 16:58:48 +00:00
Przemyslaw Gorszkowski
74d49e447f Test g_signal_handlers_disconnect_matched for G_SIGNAL_MATCH_ID match
Signed-off-by: Przemyslaw Gorszkowski <pgorszkowski@igalia.com>
2023-04-18 12:50:55 +02:00
Marco Trevisan
9f111c3416 Merge branch 'valgrind-variable' into 'main'
meson: Add glib_valgrind_suppressions variable to glib pkg-config file

See merge request GNOME/glib!3361
2023-04-17 12:52:28 +00:00
Marco Trevisan (Treviño)
c2e46b3789 meson: cleanup pkg-config variables definitions
Use more readable and shorter syntax
2023-04-17 14:25:52 +02:00
Marco Trevisan (Treviño)
ade79bcb50 meson: Add tests for generated pkg-config files
Ensure things are generated as we expect and avoid we regress on that.
2023-04-17 14:25:52 +02:00
Philip Withnall
7c1ef5c9ec Merge branch 'no-usleep-on-0' into 'main'
gtimer: Avoid doing anything on g_usleep (0)

See merge request GNOME/glib!3381
2023-04-17 11:44:36 +00:00
badcel
f510fa0227
gsocket: Explicitly mark size parameter as (in)
The generated gir file marks the size parameter as "out" by default. This is wrong in the context of a caller allocated buffer with a given size. Explicitly marking the size parameter as (in) fixes the issue.
2023-04-15 22:53:05 +02:00
Marco Trevisan (Treviño)
732e40dcfa gtimer: Avoid doing anything on g_usleep (0)
It's unlikely to happen, but still could be the case, so avoid do
anything.
2023-04-14 20:24:52 +02:00
Marco Trevisan (Treviño)
fcad56e313 meson: Add glib_valgrind_suppressions variable to glib pkg-config file
Various projects are running tests under valgrind, and they are using
the GLib suppresions to avoid false-positive results.

While this is stored in a well-known path for some years, and easy to
figure out from the GLib prefix, it's better to expose it through a
proper pkgconfig variable so that it's easy to get it from any build
system.
2023-04-14 19:20:51 +02:00
Philip Withnall
9d2f65576f Merge branch 'work-around-ucrt-spawn-env-issue' into 'main'
Work around an UCRT issue with _wspawn() functions taking an envp block

See merge request GNOME/glib!3289
2023-04-14 17:06:32 +00:00
Philip Withnall
d46405029c Merge branch 'ghash-gvariant-cheri-layout' into 'main'
Make GVariant/GHash opaque types compatible with CHERI

See merge request GNOME/glib!3146
2023-04-14 17:02:54 +00:00
Philip Withnall
da35056247 Merge branch 'registry-settings-root-key' into 'main'
gregistrysettingsbackend: Allow a different root key path

See merge request GNOME/glib!3306
2023-04-14 17:00:01 +00:00
Dario Saccavino
fee0a7679a gregistrysettingsbackend: Allow a different root key path 2023-04-14 17:00:01 +00:00
Philip Withnall
e86d8ccf28 Merge branch 'api-index' into 'main'
doc: Workaround missing API index

See merge request GNOME/glib!3308
2023-04-14 16:38:37 +00:00
Philip Withnall
cd118f9af0 Merge branch 'action-group-query-action' into 'main'
actiongroup: Add a compiler warning

See merge request GNOME/glib!3367
2023-04-14 16:32:54 +00:00
Luca Bacci
5d1046d3b2 Add test for UCRT issue workaround 2023-04-14 17:15:28 +01:00
Luca Bacci
911d091866 Work around an UCRT issue with _wspawn() functions taking an environment block argument
We were working around that with a call to chdir("."). Internally chdir()
sets up cmd shell-related environment variables, but only if the current
working directory belongs to a volume with a drive letter. For example,
if the current working directory is on a UNC volume like a network share,
the call to chdir() won't help.

Reference:
  https://developercommunity.visualstudio.com/t/UCRT-Crash-in-_wspawne-functions/10262748
2023-04-14 17:15:28 +01:00
Philip Withnall
353f2e4b3c Merge branch 'normalize-utf8-bounds-checking' into 'main'
g_utf8_normalize: don't read past the end of the buffer

See merge request GNOME/glib!3341
2023-04-14 16:14:54 +00:00
Xavier Claessens
8d27474631 doc: Workaround missing API index 2023-04-14 17:08:35 +01:00
Philip Withnall
8b45b81150 Merge branch 'pgorszkowski/add_signal_id_option_to_g_signal_handlers_block_matched' into 'main'
Support G_SIGNAL_MATCH_ID in g_signal_handlers_block/unblock/disconnect_matched()

Closes #2980

See merge request GNOME/glib!3376
2023-04-14 15:56:09 +00:00
Philip Withnall
f2f322005d Merge branch 'update-annotations' into 'main'
Explicitly mark size parameter as (in)

See merge request GNOME/glib!3371
2023-04-14 15:55:38 +00:00
Philip Withnall
3f390d5598 Merge branch '2307-mainloop-test-asan' into 'main'
tests: Re-enable mainloop test under AddressSanitizer

Closes #2307

See merge request GNOME/glib!3329
2023-04-14 15:55:06 +00:00
Philip Withnall
58cb296416 Merge branch 'feature/sum_apparent_size_only_for_files_and_symlinks' into 'main'
Align `G_FILE_MEASURE_APPARENT_SIZE` behaviour with `du` from GNU coreutils 9.2

Closes #2965

See merge request GNOME/glib!3358
2023-04-14 15:54:19 +00:00
Philip Withnall
11bdd6fcc4 Merge branch 'wip/jtojnar/wl-are-compiler-flags' into 'main'
build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags

See merge request GNOME/glib!3356
2023-04-14 15:52:56 +00:00
Todd Carson
c82f9adb19 Test g_utf8_normalize() handling of invalid UTF-8 inputs
Add three classes of test case for which g_utf8_normalize() should
safely return NULL:
 - Strings ending with a truncated multibyte character which would
   extend past the NUL terminator
 - Strings ending with a multibyte character which extends past the
   length limit provided by the max_len argument
 - Strings containing an invalid multibyte character in any position
2023-04-14 16:52:16 +01:00
Todd Carson
7f4726d151 g_utf8_normalize: don't read past the end of the buffer
_g_utf8_normalize_wc() could read past the end of the provided buffer if
it ends with a truncated multibyte character. If max_len is -1, it can
continue reading until it encounters either a NUL or unreadable
memory. Avoid this with extra bounds checks prior to g_utf8_get_char()
to ensure that it does not read past either max_len or a NUL
terminator.
2023-04-14 16:52:10 +01:00
Philip Withnall
d5a7982eeb Merge branch 'fuzz-normalize-utf8' into 'main'
Add fuzzing harness for g_utf8_normalize()

See merge request GNOME/glib!3342
2023-04-14 15:50:48 +00:00